Skip to content

Commit

Permalink
Added:
Browse files Browse the repository at this point in the history
- /v2 api endpoint scheduling delete project
Updates:
- dev server for /v2 endpoints configuration
  • Loading branch information
MarcelGeo committed Oct 6, 2023
1 parent deb261e commit cef1c53
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
3 changes: 3 additions & 0 deletions web-app/packages/admin-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export default defineConfig(({ mode }) => ({
'/v1': {
target: `http://127.0.0.1:${serverPort}`
},
'/v2': {
target: `http://127.0.0.1:${serverPort}`
},
'/app': {
target: `http://127.0.0.1:${serverPort}`
},
Expand Down
3 changes: 3 additions & 0 deletions web-app/packages/app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export default defineConfig(({ mode }) => ({
'/v1': {
target: `http://127.0.0.1:${serverPort}`
},
'/v2': {
target: `http://127.0.0.1:${serverPort}`
},
'/app': {
target: `http://127.0.0.1:${serverPort}`
},
Expand Down
13 changes: 4 additions & 9 deletions web-app/packages/lib/src/modules/project/projectApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
UpdateProjectAccessParams
} from '@/modules/project/types'


export const ProjectApi = {
async fetchProject(
namespace: string,
Expand Down Expand Up @@ -59,16 +58,12 @@ export const ProjectApi = {
},

async deleteProject(
namespace: string,
projectName: string,
id: string,
withRetry?: boolean
): Promise<AxiosResponse<void>> {
return ProjectModule.httpService.delete(
`/v1/project/${namespace ? `${namespace}/${projectName}` : projectName}`,
{
...(withRetry ? getDefaultRetryOptions() : {})
}
)
return ProjectModule.httpService.post(`/v2/projects/${id}/scheduleDelete`, {
...(withRetry ? getDefaultRetryOptions() : {})
})
},

async unsubscribeProject(id: string): Promise<AxiosResponse<void>> {
Expand Down
11 changes: 4 additions & 7 deletions web-app/packages/lib/src/modules/project/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
ProjectAccessRequest,
GetUserAccessRequestsPayload,
GetProjectAccessRequestsPayload,
DownloadPayload
DownloadPayload,
DeleteProjectPayload
} from '@/modules/project/types'
import { useUserStore } from '@/modules/user/store'

Expand Down Expand Up @@ -266,17 +267,13 @@ export const useProjectStore = defineStore('projectModule', {
}
},

async deleteProject(payload) {
async deleteProject(payload: DeleteProjectPayload) {
const notificationStore = useNotificationStore()
const userStore = useUserStore()

try {
waitCursor(true)
await ProjectApi.deleteProject(
payload.namespace,
payload.projectName,
true
)
await ProjectApi.deleteProject(payload.projectId, true)
this.setProject({ project: null })
await userStore.fetchUserProfile()
waitCursor(false)
Expand Down
4 changes: 4 additions & 0 deletions web-app/packages/lib/src/modules/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,7 @@ export interface TableDataHeader {
sortable?: boolean
width?: number
}

export interface DeleteProjectPayload {
projectId: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ export default defineComponent({
},
onDeleteProject() {
this.deleteProject({
namespace: this.namespace,
projectName: this.projectName
projectId: this.project.id
})
}
}
Expand Down

0 comments on commit cef1c53

Please sign in to comment.