mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-12 08:23:48 +02:00
3033abc3b4
Closes #1287 --------- Co-authored-by: 6543 <6543@obermui.de>
41 lines
852 B
TypeScript
41 lines
852 B
TypeScript
import { usePipelineStore } from '~/store/pipelines';
|
|
import { useRepoStore } from '~/store/repos';
|
|
|
|
import useApiClient from './useApiClient';
|
|
|
|
const apiClient = useApiClient();
|
|
let initialized = false;
|
|
|
|
export default () => {
|
|
if (initialized) {
|
|
return;
|
|
}
|
|
const repoStore = useRepoStore();
|
|
const pipelineStore = usePipelineStore();
|
|
|
|
initialized = true;
|
|
|
|
apiClient.on((data) => {
|
|
// contains repo update
|
|
if (!data.repo) {
|
|
return;
|
|
}
|
|
const { repo } = data;
|
|
repoStore.setRepo(repo);
|
|
|
|
// contains pipeline update
|
|
if (!data.pipeline) {
|
|
return;
|
|
}
|
|
const { pipeline } = data;
|
|
pipelineStore.setPipeline(repo.id, pipeline);
|
|
|
|
// contains step update
|
|
if (!data.step) {
|
|
return;
|
|
}
|
|
const { step } = data;
|
|
pipelineStore.setWorkflow(repo.id, pipeline.number, step);
|
|
});
|
|
};
|