From 73210a869048d6468b55717660d0ca558d0c2aab Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期一, 24 十一月 2025 09:49:43 +0800
Subject: [PATCH] 优化
---
service/common.ts | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/service/common.ts b/service/common.ts
index e76cfb4..a2f942e 100644
--- a/service/common.ts
+++ b/service/common.ts
@@ -40,7 +40,7 @@
type LoginSuccess = {
result: 'success'
- data: { access_token: string; refresh_token: string }
+ data: { access_token: string;refresh_token: string }
}
type LoginFail = {
result: 'fail'
@@ -71,6 +71,10 @@
export const fetchSetupStatus = () => {
return get<SetupStatusResponse>('/setup')
+}
+
+export const regAndLogin: Fetcher<CommonResponse, { body: Record<string, any> }> = ({ body }) => {
+ return post<CommonResponse>('/regAndLogin', { body })
}
export const fetchUserProfile: Fetcher<UserProfileOriginResponse, { url: string; params: Record<string, any> }> = ({ url, params }) => {
@@ -146,10 +150,6 @@
export const switchWorkspace: Fetcher<CommonResponse & { new_tenant: IWorkspace }, { url: string; body: Record<string, any> }> = ({ url, body }) => {
return post<CommonResponse & { new_tenant: IWorkspace }>(url, { body })
-}
-
-export const updateWorkspaceInfo: Fetcher<ICurrentWorkspace, { url: string; body: Record<string, any> }> = ({ url, body }) => {
- return post<ICurrentWorkspace>(url, { body })
}
export const fetchDataSource: Fetcher<{ data: DataSourceNotion[] }, { url: string }> = ({ url }) => {
@@ -261,6 +261,10 @@
return get<FileUploadConfigResponse>(url)
}
+export const fetchFreeQuotaVerify: Fetcher<{ result: string; flag: boolean; reason: string }, string> = (url) => {
+ return get(url) as Promise<{ result: string; flag: boolean; reason: string }>
+}
+
export const fetchNotionConnection: Fetcher<{ data: string }, string> = (url) => {
return get(url) as Promise<{ data: string }>
}
@@ -298,7 +302,7 @@
}
type RetrievalMethodsRes = {
- retrieval_method: RETRIEVE_METHOD[]
+ 'retrieval_method': RETRIEVE_METHOD[]
}
export const fetchSupportRetrievalMethods: Fetcher<RetrievalMethodsRes, string> = (url) => {
return get<RetrievalMethodsRes>(url)
@@ -331,23 +335,20 @@
export const sendEMailLoginCode = (email: string, language = 'en-US') =>
post<CommonResponse & { data: string }>('/email-code-login', { body: { email, language } })
-export const emailLoginWithCode = (data: { email: string; code: string; token: string }) =>
+export const emailLoginWithCode = (data: { email: string;code: string;token: string }) =>
post<LoginResponse>('/email-code-login/validity', { body: data })
export const sendResetPasswordCode = (email: string, language = 'en-US') =>
- post<CommonResponse & { data: string; message?: string; code?: string }>('/forgot-password', { body: { email, language } })
+ post<CommonResponse & { data: string;message?: string ;code?: string }>('/forgot-password', { body: { email, language } })
-export const verifyResetPasswordCode = (body: { email: string; code: string; token: string }) =>
- post<CommonResponse & { is_valid: boolean; token: string }>('/forgot-password/validity', { body })
+export const verifyResetPasswordCode = (body: { email: string;code: string;token: string }) =>
+ post<CommonResponse & { is_valid: boolean }>('/forgot-password/validity', { body })
export const sendDeleteAccountCode = () =>
get<CommonResponse & { data: string }>('/account/delete/verify')
-export const verifyDeleteAccountCode = (body: { code: string; token: string }) =>
+export const verifyDeleteAccountCode = (body: { code: string;token: string }) =>
post<CommonResponse & { is_valid: boolean }>('/account/delete', { body })
-export const submitDeleteAccountFeedback = (body: { feedback: string; email: string }) =>
+export const submitDeleteAccountFeedback = (body: { feedback: string;email: string }) =>
post<CommonResponse>('/account/delete/feedback', { body })
-
-export const getDocDownloadUrl = (doc_name: string) =>
- get<{ url: string }>('/compliance/download', { params: { doc_name } }, { silent: true })
--
Gitblit v1.8.0