diff --git a/src/api/subs/index.ts b/src/api/subs/index.ts index 17216db7c..3849ad242 100644 --- a/src/api/subs/index.ts +++ b/src/api/subs/index.ts @@ -91,12 +91,25 @@ export function useSubsApi() { data, }); }, - shareSub: (data: ShareToken): AxiosPromise => { + shareCreate: (data: ShareToken): AxiosPromise => { return request({ url: `/api/token`, method: 'post', data, }); }, + shareDelete: (token: string): AxiosPromise => { + return request({ + url: `/api/token/${encodeURIComponent(token)}`, + method: 'delete', + }); + }, + shareQuery: (type: string, name: string): AxiosPromise => { + return request({ + url: `/api/tokens`, + method: 'get', + params: { type, name }, + }); + }, }; } diff --git a/src/components/ShareListItem.vue b/src/components/ShareListItem.vue new file mode 100644 index 000000000..e69de29bb diff --git a/src/router/index.ts b/src/router/index.ts index 4a2065b75..0e31ae3c3 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -14,6 +14,8 @@ import FileEditor from '@/views/FileEditor.vue'; // import editScript from '@/views/editCode/editScript.vue'; import IconCollection from '@/views/icon/IconCollection.vue'; +import Share from '@/views/share/Share.vue'; + import Sub from '@/views/Sub.vue'; import SubEditor from '@/views/SubEditor.vue'; @@ -158,6 +160,15 @@ const router = createRouter({ needNavBack: true, }, }, + { + path: '/share', + component: Share, + meta: { + title: 'share', + needTabBar: true, + needNavBack: true, + }, + }, { path: '/settings/more', component: moreSetting, diff --git a/src/views/share/Share.vue b/src/views/share/Share.vue new file mode 100644 index 000000000..aae0eda90 --- /dev/null +++ b/src/views/share/Share.vue @@ -0,0 +1,38 @@ + + + + + + diff --git a/src/views/share/SharePopup.vue b/src/views/share/SharePopup.vue index cef906c55..94568d0fe 100644 --- a/src/views/share/SharePopup.vue +++ b/src/views/share/SharePopup.vue @@ -290,7 +290,7 @@ const handleCreateShare = async () => { if (form.token) { params.payload.token = form.token; } - const res = await subsApi.shareSub(params); + const res = await subsApi.shareCreate(params); if (res?.data?.status === "success") { isCreateShareLinkSuccess.value = true; const { secret, token } = res.data.data;