From 659a8c9ca76b41b688bc0c704e4d0ef4925a9903 Mon Sep 17 00:00:00 2001 From: "marcel.kocisek" Date: Wed, 15 Jan 2025 10:54:12 +0100 Subject: [PATCH] Fix: public switch --- web-app/packages/lib/src/modules/project/projectApi.ts | 2 +- web-app/packages/lib/src/modules/project/store.ts | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/web-app/packages/lib/src/modules/project/projectApi.ts b/web-app/packages/lib/src/modules/project/projectApi.ts index 7dd04ba7..b12666f6 100644 --- a/web-app/packages/lib/src/modules/project/projectApi.ts +++ b/web-app/packages/lib/src/modules/project/projectApi.ts @@ -208,7 +208,7 @@ export const ProjectApi = { data: UpdatePublicFlagParams, withRetry?: boolean ): Promise> { - return ProjectModule.httpService.patch(`/app/project/${id}/access`, data, { + return ProjectModule.httpService.patch(`/app/project/${id}/public`, data, { ...(withRetry ? getDefaultRetryOptions() : {}) }) }, diff --git a/web-app/packages/lib/src/modules/project/store.ts b/web-app/packages/lib/src/modules/project/store.ts index ed8034c9..7366c4f7 100644 --- a/web-app/packages/lib/src/modules/project/store.ts +++ b/web-app/packages/lib/src/modules/project/store.ts @@ -884,11 +884,8 @@ export const useProjectStore = defineStore('projectModule', { const notificationStore = useNotificationStore() this.accessLoading = true try { - const response = await ProjectApi.updatePublicFlag( - payload.projectId, - payload.data - ) - this.project.access = response.data + await ProjectApi.updatePublicFlag(payload.projectId, payload.data) + this.project.access.public = !this.project.access?.public } catch { notificationStore.error({ text: `Failed to update public flag`