Skip to content

Commit

Permalink
feat: 新增分享管理模块
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyin committed Nov 6, 2024
1 parent 24a1c96 commit 3eb0fc1
Show file tree
Hide file tree
Showing 12 changed files with 1,043 additions and 39 deletions.
28 changes: 28 additions & 0 deletions src/api/share/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { AxiosPromise } from "axios";

import request from "@/api";

export function useShareApi() {
return {
createShare: (data: ShareToken): AxiosPromise<MyAxiosRes> => {
return request({
url: `/api/token`,
method: "post",
data,
});
},
deleteShare: (token: string): AxiosPromise<MyAxiosRes> => {
return request({
url: `/api/token/${encodeURIComponent(token)}`,
method: "delete",
});
},
getShares: (type?: string, name?: string): AxiosPromise<MyAxiosRes> => {
return request({
url: `/api/tokens`,
method: "get",
params: { type, name },
});
},
};
}
20 changes: 0 additions & 20 deletions src/api/subs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,5 @@ export function useSubsApi() {
data,
});
},
shareCreate: (data: ShareToken): AxiosPromise<MyAxiosRes> => {
return request({
url: `/api/token`,
method: 'post',
data,
});
},
shareDelete: (token: string): AxiosPromise<MyAxiosRes> => {
return request({
url: `/api/token/${encodeURIComponent(token)}`,
method: 'delete',
});
},
shareQuery: (type: string, name: string): AxiosPromise<MyAxiosRes> => {
return request({
url: `/api/tokens`,
method: 'get',
params: { type, name },
});
},
};
}
Loading

0 comments on commit 3eb0fc1

Please sign in to comment.