diff --git a/packages/ui/certd-client/src/api/service.ts b/packages/ui/certd-client/src/api/service.ts index 6a27fb9f3..02b4a99df 100644 --- a/packages/ui/certd-client/src/api/service.ts +++ b/packages/ui/certd-client/src/api/service.ts @@ -136,27 +136,29 @@ function createService() { */ function createRequestFunction(service: any) { return function (config: any) { - const configDefault = { + const configDefault: any = { headers: { "Content-Type": get(config, "headers.Content-Type", "application/json"), } as any, timeout: 30000, baseURL: env.API, data: {}, + params: {}, }; const projectStore = useProjectStore(); - if (projectStore.isEnterprise && !config.url.startsWith("/sys") && !config.url.startsWith("http")) { - configDefault.headers["project-id"] = projectStore.currentProjectId; - } - const userStore = useUserStore(); const token = userStore.getToken; if (token != null) { // @ts-ignore configDefault.headers.Authorization = token; } - return service(Object.assign(configDefault, config)); + Object.assign(configDefault, config); + + if (projectStore.isEnterprise && !config.url.startsWith("/sys") && !config.url.startsWith("http")) { + configDefault.params.projectId = projectStore.currentProjectId; + } + return service(configDefault); }; } diff --git a/packages/ui/certd-client/src/components/index.ts b/packages/ui/certd-client/src/components/index.ts index fdb3d94a5..418472789 100644 --- a/packages/ui/certd-client/src/components/index.ts +++ b/packages/ui/certd-client/src/components/index.ts @@ -17,6 +17,8 @@ import NotificationSelector from "../views/certd/notification/notification-selec import EmailSelector from "./email-selector/index.vue"; import ValidTimeFormat from "./valid-time-format.vue"; import ProjectSelector from "./project-selector/index.vue"; +import ProjectCurrent from "./project-selector/project-current.vue"; + export default { install(app: any) { app.component( @@ -47,5 +49,6 @@ export default { app.use(vip); app.use(Plugins); app.component("ProjectSelector", ProjectSelector); + app.component("ProjectCurrent", ProjectCurrent); }, }; diff --git a/packages/ui/certd-client/src/components/project-selector/project-current.vue b/packages/ui/certd-client/src/components/project-selector/project-current.vue new file mode 100644 index 000000000..5ca94cf6b --- /dev/null +++ b/packages/ui/certd-client/src/components/project-selector/project-current.vue @@ -0,0 +1,28 @@ + + + + diff --git a/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue b/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue index abd8eecc1..8455eb7db 100644 --- a/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue +++ b/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue @@ -35,6 +35,11 @@ + +