Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor: re-implement repository store module with pinia (#1105)

Liu Jia91634a5a22c
diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
index 0377471468..e0056d65a8 100644
--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
@@ -89,7 +89,6 @@
<script lang="ts">
import { computed, reactive, PropType, defineComponent } from "vue";
-import { useStore } from "vuex";
import { useRouter } from "vue-router";
import DatabaseTable from "../DatabaseTable.vue";
import {
@@ -121,6 +120,7 @@ import {
useDatabaseStore,
useEnvironmentList,
useProjectStore,
+ useRepositoryStore,
} from "@/store";
type LocalState = ProjectStandardState &
@@ -156,11 +156,11 @@ export default defineComponent({
},
emits: ["dismiss"],
setup(props, { emit }) {
- const store = useStore();
const router = useRouter();
const currentUser = useCurrentUser();
const projectStore = useProjectStore();
+ const repositoryStore = useRepositoryStore();
useEventListener(window, "keydown", (e) => {
if (e.code === "Escape") {
@@ -291,8 +291,8 @@ export default defineComponent({
},
});
} else if (project.workflowType === "VCS") {
- store
- .dispatch("repository/fetchRepositoryByProjectId", project.id)
+ repositoryStore
+ .fetchRepositoryByProjectId(project.id)
.then((repository: Repository) => {
window.open(baseDirectoryWebUrl(repository), "_blank");
});
@@ -318,11 +318,8 @@ export default defineComponent({
},
});
} else if (database.project.workflowType == "VCS") {
- store
- .dispatch(
- "repository/fetchRepositoryByProjectId",
- database.project.id
- )
+ repositoryStore
+ .fetchRepositoryByProjectId(database.project.id)
.then((repository: Repository) => {
window.open(baseDirectoryWebUrl(repository), "_blank");
});
diff --git a/frontend/src/components/ProjectMemberPanel.vue b/frontend/src/components/ProjectMemberPanel.vue
index a7176b017b..cba991685a 100644
--- a/frontend/src/components/ProjectMemberPanel.vue
+++ b/frontend/src/components/ProjectMemberPanel.vue
@@ -157,7 +157,6 @@
<script lang="ts">
import { computed, defineComponent, PropType, reactive } from "vue";
-import { useStore } from "vuex";
import MemberSelect from "../components/MemberSelect.vue";
import ProjectMemberTable from "../components/ProjectMemberTable.vue";
import {
@@ -179,6 +178,7 @@ import {
useCurrentUser,
useMemberStore,
useProjectStore,
+ useRepositoryStore,
} from "@/store";
interface LocalState {
@@ -201,7 +201,6 @@ export default defineComponent({
},
},
setup(props) {
- const store = useStore();
const { t } = useI18n();
const currentUser = useCurrentUser();
@@ -340,8 +339,8 @@ export default defineComponent({
const openWindowForVCSMember = () => {
// currently we only support Gitlab, so the following redirect URL is fixed
- store
- .dispatch("repository/fetchRepositoryByProjectId", props.project.id)
+ useRepositoryStore()
+ .fetchRepositoryByProjectId(props.project.id)
.then((repository) => {
// this uri format is for GitLab
window.open(`${repository.webUrl}/-/project_members`);
diff --git a/frontend/src/components/ProjectVersionControlPanel.vue b/frontend/src/components/ProjectVersionControlPanel.vue
index 82fc066847..342332c2d6 100644
--- a/frontend/src/components/ProjectVersionControlPanel.vue
+++ b/frontend/src/components/ProjectVersionControlPanel.vue
@@ -90,10 +90,9 @@ import { reactive, watchEffect, watch, defineComponent } from "vue";
import { computed, PropType } from "vue";
import RepositorySetupWizard from "./RepositorySetupWizard.vue";
import RepositoryPanel from "./RepositoryPanel.vue";
-import { Project, ProjectWorkflowType, Repository, UNKNOWN_ID } from "../types";
-import { useStore } from "vuex";
+import { Project, ProjectWorkflowType, UNKNOWN_ID } from "../types";
import { useI18n } from "vue-i18n";
-import { pushNotification } from "@/store";
+import { pushNotification, useRepositoryStore } from "@/store";
interface LocalState {
workflowType: ProjectWorkflowType;
@@ -120,7 +119,7 @@ export default defineComponent({
async setup(props) {
const { t } = useI18n();
- const store = useStore();
+ const repositoryStore = useRepositoryStore();
const state = reactive<LocalState>({
workflowType: props.project.workflowType,
@@ -129,7 +128,7 @@ export default defineComponent({
});
const prepareRepository = () => {
- store.dispatch("repository/fetchRepositoryByProjectId", props.project.id);
+ repositoryStore.fetchRepositoryByProjectId(props.project.id);
};
watchEffect(prepareRepository);
@@ -141,10 +140,8 @@ export default defineComponent({
}
);
- const repository = computed((): Repository => {
- return store.getters["repository/repositoryByProjectId"](
- props.project.id
- );
+ const repository = computed(() => {
+ return repositoryStore.getRepositoryByProjectId(props.project.id);
});
const enterWizard = (create: boolean) => {
diff --git a/frontend/src/components/RepositoryPanel.vue b/frontend/src/components/RepositoryPanel.vue
index c5def1d7d2..c51c1ed6db 100644
--- a/frontend/src/components/RepositoryPanel.vue
+++ b/frontend/src/components/RepositoryPanel.vue
@@ -91,9 +91,8 @@ import {
RepositoryConfig,
Project,
} from "../types";
-import { useStore } from "vuex";
import { useI18n } from "vue-i18n";
-import { pushNotification } from "@/store";
+import { pushNotification, useRepositoryStore } from "@/store";
interface LocalState {
repositoryConfig: RepositoryConfig;
@@ -119,7 +118,7 @@ export default defineComponent({
emits: ["change-repository"],
setup(props) {
const { t } = useI18n();
- const store = useStore();
+ const repositoryStore = useRepositoryStore();
const state = reactive<LocalState>({
repositoryConfig: {
baseDirectory: props.repository.baseDirectory,
@@ -165,15 +164,13 @@ export default defineComponent({
});
const restoreToUIWorkflowType = () => {
- store
- .dispatch("repository/deleteRepositoryByProjectId", props.project.id)
- .then(() => {
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("repository.restore-ui-workflow-success"),
- });
+ repositoryStore.deleteRepositoryByProjectId(props.project.id).then(() => {
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("repository.restore-ui-workflow-success"),
});
+ });
};
const doUpdate = () => {
@@ -202,8 +199,8 @@ export default defineComponent({
repositoryPatch.schemaPathTemplate =
state.repositoryConfig.schemaPathTemplate;
}
- store
- .dispatch("repository/updateRepositoryByProjectId", {
+ repositoryStore
+ .updateRepositoryByProjectId({
projectId: props.project.id,
repositoryPatch,
})
diff --git a/frontend/src/components/RepositorySetupWizard.vue b/frontend/src/components/RepositorySetupWizard.vue
index a2c9338931..97ef79a90d 100644
--- a/frontend/src/components/RepositorySetupWizard.vue
+++ b/frontend/src/components/RepositorySetupWizard.vue
@@ -45,7 +45,6 @@
<script lang="ts">
import { reactive, computed, PropType, defineComponent } from "vue";
-import { useStore } from "vuex";
import { useRouter } from "vue-router";
import isEmpty from "lodash-es/isEmpty";
import { BBStepTabItem } from "../bbkit/types";
@@ -63,6 +62,7 @@ import {
} from "../types";
import { projectSlug } from "../utils";
import { useI18n } from "vue-i18n";
+import { useRepositoryStore } from "@/store";
// Default file path template is to organize migration files from different environments under separate directories.
const DEFAULT_FILE_PATH_TEMPLATE =
@@ -107,7 +107,7 @@ export default defineComponent({
const { t } = useI18n();
const router = useRouter();
- const store = useStore();
+ const repositoryStore = useRepositoryStore();
const stepList: BBStepTabItem[] = [
{ title: t("repository.choose-git-provider"), hideNext: true },
@@ -183,8 +183,8 @@ export default defineComponent({
expiresTs: state.config.token.expiresTs,
refreshToken: state.config.token.refreshToken,
};
- store
- .dispatch("repository/createRepository", {
+ repositoryStore
+ .createRepository({
projectId: props.project.id,
repositoryCreate,
})
@@ -199,8 +199,8 @@ export default defineComponent({
// It's simple to implement change behavior as delete followed by create.
// Though the delete can succeed while the create fails, this is rare, and
// even it happens, user can still configure it again.
- store
- .dispatch("repository/deleteRepositoryByProjectId", props.project.id)
+ repositoryStore
+ .deleteRepositoryByProjectId(props.project.id)
.then(() => {
createFunc();
});
diff --git a/frontend/src/store/modules/repository.ts b/frontend/src/store/modules/repository.ts
deleted file mode 100644
index a9e07f1594..0000000000
--- a/frontend/src/store/modules/repository.ts
+++ /dev/null
@@ -1,227 +0,0 @@
-import axios from "axios";
-import {
- Project,
- ProjectId,
- Repository,
- RepositoryCreate,
- RepositoryPatch,
- RepositoryState,
- ResourceIdentifier,
- ResourceObject,
- unknown,
- VCS,
- VCSId,
-} from "../../types";
-import { getPrincipalFromIncludedList } from "../pinia";
-import { useVCSStore, useProjectStore } from "@/store";
-
-function convert(
- repository: ResourceObject,
- includedList: ResourceObject[],
- rootGetters: any
-): Repository {
- const vcsId = (repository.relationships!.vcs.data as ResourceIdentifier).id;
- let vcs: VCS = unknown("VCS") as VCS;
- vcs.id = parseInt(vcsId);
- const vcsStore = useVCSStore();
- const projectStore = useProjectStore();
-
- const projectId = (
- repository.relationships!.project.data as ResourceIdentifier
- ).id;
- let project: Project = unknown("PROJECT") as Project;
- project.id = parseInt(projectId);
-
- for (const item of includedList || []) {
- if (item.type == "vcs" && item.id == vcsId) {
- vcs = vcsStore.convert(item, includedList || []);
- }
- if (item.type == "project" && item.id == projectId) {
- project = projectStore.convert(item, includedList);
- }
- }
-
- return {
- ...(repository.attributes as Omit<
- Repository,
- "id" | "vcs" | "project" | "creator" | "updater"
- >),
- id: parseInt(repository.id),
- creator: getPrincipalFromIncludedList(
- repository.relationships!.creator.data,
- includedList
- ),
- updater: getPrincipalFromIncludedList(
- repository.relationships!.updater.data,
- includedList
- ),
- vcs,
- project,
- };
-}
-
-const state: () => RepositoryState = () => ({
- repositoryListByVCSId: new Map(),
- repositoryByProjectId: new Map(),
-});
-
-const getters = {
- repositoryListByVCSId:
- (state: RepositoryState) =>
- (vcsId: VCSId): Repository[] => {
- return state.repositoryListByVCSId.get(vcsId) || [];
- },
-
- repositoryByProjectId:
- (state: RepositoryState) =>
- (projectId: ProjectId): Repository => {
- return (
- state.repositoryByProjectId.get(projectId) ||
- (unknown("REPOSITORY") as Repository)
- );
- },
-};
-
-const actions = {
- async createRepository(
- { dispatch, commit, rootGetters }: any,
- {
- projectId,
- repositoryCreate,
- }: { projectId: ProjectId; repositoryCreate: RepositoryCreate }
- ): Promise<Repository> {
- const data = (
- await axios.post(`/api/project/${projectId}/repository`, {
- data: {
- type: "RepositoryCreate",
- attributes: repositoryCreate,
- },
- })
- ).data;
-
- const createdRepository = convert(data.data, data.included, rootGetters);
- commit("setRepositoryByProjectId", {
- projectId: projectId,
- repository: createdRepository,
- });
-
- // Refetch the project as the project workflow type has been updated to "VCS"
- useProjectStore().fetchProjectById(projectId);
-
- return createdRepository;
- },
-
- async fetchRepositoryListByVCSId(
- { commit, rootGetters }: any,
- vcsId: VCSId
- ): Promise<Repository[]> {
- const data = (await axios.get(`/api/vcs/${vcsId}/repository`)).data;
-
- const repositoryList = data.data.map((repository: ResourceObject) => {
- return convert(repository, data.included, rootGetters);
- });
-
- commit("setRepositoryListByVCSId", { vcsId, repositoryList });
- return repositoryList;
- },
-
- async fetchRepositoryByProjectId(
- { commit, rootGetters }: any,
- projectId: ProjectId
- ): Promise<Repository> {
- const data = (await axios.get(`/api/project/${projectId}/repository`)).data;
- const repositoryList = data.data.map((repository: ResourceObject) => {
- return convert(repository, data.included, rootGetters);
- });
-
- // Expect server to return at most one item, otherwise it will throw error
- if (repositoryList.length > 0) {
- commit("setRepositoryByProjectId", {
- projectId,
- repository: repositoryList[0],
- });
- return repositoryList[0];
- }
-
- return unknown("REPOSITORY") as Repository;
- },
-
- async updateRepositoryByProjectId(
- { commit, rootGetters }: any,
- {
- projectId,
- repositoryPatch,
- }: {
- projectId: ProjectId;
- repositoryPatch: RepositoryPatch;
- }
- ) {
- const data = (
- await axios.patch(`/api/project/${projectId}/repository`, {
- data: {
- type: "repositoryPatch",
- attributes: repositoryPatch,
- },
- })
- ).data;
-
- const updatedRepository = convert(data.data, data.included, rootGetters);
- commit("setRepositoryByProjectId", {
- projectId,
- repository: updatedRepository,
- });
-
- return updatedRepository;
- },
-
- async deleteRepositoryByProjectId(
- { dispatch, commit }: any,
- projectId: ProjectId
- ) {
- await axios.delete(`/api/project/${projectId}/repository`);
- commit("deleteRepositoryByProjectId", projectId);
-
- // Refetch the project as the project workflow type has been updated to "UI"
- useProjectStore().fetchProjectById(projectId);
- },
-};
-
-const mutations = {
- setRepositoryListByVCSId(
- state: RepositoryState,
- {
- vcsId,
- repositoryList,
- }: {
- vcsId: VCSId;
- repositoryList: Repository[];
- }
- ) {
- state.repositoryListByVCSId.set(vcsId, repositoryList);
- },
-
- setRepositoryByProjectId(
- state: RepositoryState,
- {
- projectId,
- repository,
- }: {
- projectId: ProjectId;
- repository: Repository;
- }
- ) {
- state.repositoryByProjectId.set(projectId, repository);
- },
-
- deleteRepositoryByProjectId(state: RepositoryState, projectId: ProjectId) {
- state.repositoryByProjectId.delete(projectId);
- },
-};
-
-export default {
- namespaced: true,
- state,
- getters,
- actions,
- mutations,
-};
diff --git a/frontend/src/store/pinia-modules/index.ts b/frontend/src/store/pinia-modules/index.ts
index 8c05ed07d1..ce10725d50 100644
--- a/frontend/src/store/pinia-modules/index.ts
+++ b/frontend/src/store/pinia-modules/index.ts
@@ -24,6 +24,7 @@ export * from "./policy";
export * from "./principal";
export * from "./project";
export * from "./projectWebhook";
+export * from "./repository";
export * from "./router";
export * from "./setting";
export * from "./sheet";
diff --git a/frontend/src/store/pinia-modules/repository.ts b/frontend/src/store/pinia-modules/repository.ts
new file mode 100644
index 0000000000..de20c6bf94
--- /dev/null
+++ b/frontend/src/store/pinia-modules/repository.ts
@@ -0,0 +1,195 @@
+import axios from "axios";
+import { defineStore } from "pinia";
+import {
+ Project,
+ ProjectId,
+ Repository,
+ RepositoryCreate,
+ RepositoryPatch,
+ RepositoryState,
+ ResourceIdentifier,
+ ResourceObject,
+ unknown,
+ VCS,
+ VCSId,
+} from "../../types";
+import { getPrincipalFromIncludedList } from "./principal";
+import { useProjectStore } from "./project";
+import { useVCSStore } from "./vcs";
+
+function convert(
+ repository: ResourceObject,
+ includedList: ResourceObject[]
+): Repository {
+ const vcsId = (repository.relationships!.vcs.data as ResourceIdentifier).id;
+ let vcs: VCS = unknown("VCS") as VCS;
+ vcs.id = parseInt(vcsId);
+
+ const projectId = (
+ repository.relationships!.project.data as ResourceIdentifier
+ ).id;
+ let project: Project = unknown("PROJECT") as Project;
+ project.id = parseInt(projectId);
+
+ const vcsStore = useVCSStore();
+ const projectStore = useProjectStore();
+ for (const item of includedList || []) {
+ if (item.type == "vcs" && item.id == vcsId) {
+ vcs = vcsStore.convert(item, includedList || []);
+ }
+ if (item.type == "project" && item.id == projectId) {
+ project = projectStore.convert(item, includedList);
+ }
+ }
+
+ return {
+ ...(repository.attributes as Omit<
+ Repository,
+ "id" | "vcs" | "project" | "creator" | "updater"
+ >),
+ id: parseInt(repository.id),
+ creator: getPrincipalFromIncludedList(
+ repository.relationships!.creator.data,
+ includedList
+ ),
+ updater: getPrincipalFromIncludedList(
+ repository.relationships!.updater.data,
+ includedList
+ ),
+ vcs,
+ project,
+ };
+}
+
+export const useRepositoryStore = defineStore("repository", {
+ state: (): RepositoryState => ({
+ repositoryListByVCSId: new Map(),
+ repositoryByProjectId: new Map(),
+ }),
+ actions: {
+ getRepositoryListByVCSId(vcsId: VCSId): Repository[] {
+ return this.repositoryListByVCSId.get(vcsId) || [];
+ },
+ getRepositoryByProjectId(projectId: ProjectId): Repository {
+ return (
+ this.repositoryByProjectId.get(projectId) ||
+ (unknown("REPOSITORY") as Repository)
+ );
+ },
+ setRepositoryListByVCSId({
+ vcsId,
+ repositoryList,
+ }: {
+ vcsId: VCSId;
+ repositoryList: Repository[];
+ }) {
+ this.repositoryListByVCSId.set(vcsId, repositoryList);
+ },
+ setRepositoryByProjectId({
+ projectId,
+ repository,
+ }: {
+ projectId: ProjectId;
+ repository: Repository;
+ }) {
+ this.repositoryByProjectId.set(projectId, repository);
+ },
+ removeRepositoryByProjectId(projectId: ProjectId) {
+ this.repositoryByProjectId.delete(projectId);
+ },
+ async createRepository({
+ projectId,
+ repositoryCreate,
+ }: {
+ projectId: ProjectId;
+ repositoryCreate: RepositoryCreate;
+ }): Promise<Repository> {
+ const data = (
+ await axios.post(`/api/project/${projectId}/repository`, {
+ data: {
+ type: "RepositoryCreate",
+ attributes: repositoryCreate,
+ },
+ })
+ ).data;
+
+ const createdRepository = convert(data.data, data.included);
+ this.setRepositoryByProjectId({
+ projectId: projectId,
+ repository: createdRepository,
+ });
+
+ // Refetch the project as the project workflow type has been updated to "VCS"
+ useProjectStore().fetchProjectById(projectId);
+
+ return createdRepository;
+ },
+ async fetchRepositoryListByVCSId(vcsId: VCSId): Promise<Repository[]> {
+ const data = (await axios.get(`/api/vcs/${vcsId}/repository`)).data;
+
+ const repositoryList: Repository[] = data.data.map(
+ (repository: ResourceObject) => {
+ return convert(repository, data.included);
+ }
+ );
+
+ this.setRepositoryListByVCSId({ vcsId, repositoryList });
+ return repositoryList;
+ },
+ async fetchRepositoryByProjectId(
+ projectId: ProjectId
+ ): Promise<Repository> {
+ const data = (await axios.get(`/api/project/${projectId}/repository`))
+ .data;
+ const repositoryList: Repository[] = data.data.map(
+ (repository: ResourceObject) => {
+ return convert(repository, data.included);
+ }
+ );
+
+ // Expect server to return at most one item, otherwise it will throw error
+ if (repositoryList.length > 0) {
+ this.setRepositoryByProjectId({
+ projectId,
+ repository: repositoryList[0],
+ });
+ return repositoryList[0];
+ }
+
+ return unknown("REPOSITORY") as Repository;
+ },
+ async updateRepositoryByProjectId({
+ projectId,
+ repositoryPatch,
+ }: {
+ projectId: ProjectId;
+ repositoryPatch: RepositoryPatch;
+ }) {
+ const data = (
+ await axios.patch(`/api/project/${projectId}/repository`, {
+ data: {
+ type: "repositoryPatch",
+ attributes: repositoryPatch,
+ },
+ })
+ ).data;
+
+ const updatedRepository = convert(data.data, data.included);
+
+ this.setRepositoryByProjectId({
+ projectId,
+ repository: updatedRepository,
+ });
+
+ return updatedRepository;
+ },
+ async deleteRepositoryByProjectId(projectId: ProjectId) {
+ await axios.delete(`/api/project/${projectId}/repository`);
+
+ this.removeRepositoryByProjectId(projectId);
+
+ // Refetch the project as the project workflow type has been updated to "UI"
+ useProjectStore().fetchProjectById(projectId);
+ },
+ },
+});
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index a3ee7d4153..0c89b4d2b9 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -284,7 +284,6 @@
<script lang="ts">
import { computed, onMounted, reactive, watch, defineComponent } from "vue";
-import { useStore } from "vuex";
import { useRouter } from "vue-router";
import ProjectSelect from "../components/ProjectSelect.vue";
import DatabaseBackupPanel from "../components/DatabaseBackupPanel.vue";
@@ -305,7 +304,12 @@ import {
} from "../types";
import { BBTabFilterItem } from "../bbkit/types";
import { useI18n } from "vue-i18n";
-import { pushNotification, useCurrentUser, useDatabaseStore } from "@/store";
+import {
+ pushNotification,
+ useCurrentUser,
+ useDatabaseStore,
+ useRepositoryStore,
+} from "@/store";
const OVERVIEW_TAB = 0;
const MIGRATION_HISTORY_TAB = 1;
@@ -341,8 +345,8 @@ export default defineComponent({
},
},
setup(props) {
- const store = useStore();
const databaseStore = useDatabaseStore();
+ const repositoryStore = useRepositoryStore();
const router = useRouter();
const { t } = useI18n();
@@ -493,11 +497,8 @@ export default defineComponent({
},
});
} else if (database.value.project.workflowType == "VCS") {
- store
- .dispatch(
- "repository/fetchRepositoryByProjectId",
- database.value.project.id
- )
+ repositoryStore
+ .fetchRepositoryByProjectId(database.value.project.id)
.then((repository: Repository) => {
window.open(baseDirectoryWebUrl(repository), "_blank");
});
@@ -519,11 +520,8 @@ export default defineComponent({
},
});
} else if (database.value.project.workflowType == "VCS") {
- store
- .dispatch(
- "repository/fetchRepositoryByProjectId",
- database.value.project.id
- )
+ repositoryStore
+ .fetchRepositoryByProjectId(database.value.project.id)
.then((repository: Repository) => {
window.open(baseDirectoryWebUrl(repository), "_blank");
});
diff --git a/frontend/src/views/SettingWorkspaceVCSDetail.vue b/frontend/src/views/SettingWorkspaceVCSDetail.vue
index 133033453a..60ec597f5b 100644
--- a/frontend/src/views/SettingWorkspaceVCSDetail.vue
+++ b/frontend/src/views/SettingWorkspaceVCSDetail.vue
@@ -145,7 +145,6 @@ import {
onUnmounted,
defineComponent,
} from "vue";
-import { useStore } from "vuex";
import { useRouter } from "vue-router";
import RepositoryTable from "../components/RepositoryTable.vue";
import isEmpty from "lodash-es/isEmpty";
@@ -157,7 +156,12 @@ import {
OAuthWindowEventPayload,
OAuthToken,
} from "../types";
-import { pushNotification, useOAuthStore, useVCSStore } from "@/store";
+import {
+ pushNotification,
+ useOAuthStore,
+ useRepositoryStore,
+ useVCSStore,
+} from "@/store";
interface LocalState {
name: string;
@@ -176,8 +180,8 @@ export default defineComponent({
},
},
setup(props) {
- const store = useStore();
const vcsStore = useVCSStore();
+ const repositoryStore = useRepositoryStore();
const router = useRouter();
const vcs = computed((): VCS => {
@@ -220,7 +224,7 @@ export default defineComponent({
};
const prepareRepositoryList = () => {
- store.dispatch("repository/fetchRepositoryListByVCSId", vcs.value.id);
+ repositoryStore.fetchRepositoryListByVCSId(vcs.value.id);
};
watchEffect(prepareRepositoryList);
@@ -233,7 +237,7 @@ export default defineComponent({
});
const repositoryList = computed(() =>
- store.getters["repository/repositoryListByVCSId"](vcs.value.id)
+ repositoryStore.getRepositoryListByVCSId(vcs.value.id)
);
const allowUpdate = computed(() => {