mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
- refactor pipeline parsing
- do not parse the pipeline multiple times to perform filter checks, do
this once and perform checks on the result directly
- code deduplication
- refactor forge token refreshing
- move refreshing to a helper func to reduce code
---------
Co-authored-by: Anbraten <anton@ju60.de>
34 lines
691 B
TypeScript
34 lines
691 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);
|
|
});
|
|
};
|