fix: 全局格式化

This commit is contained in:
Tim
2025-08-11 18:16:13 +08:00
parent 31cff70f63
commit 1c4df40f12
76 changed files with 1442 additions and 939 deletions

View File

@@ -18,7 +18,12 @@ export async function githubExchange(code, state, reason) {
const res = await fetch(`${API_BASE_URL}/api/auth/github`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ code, redirectUri: `${window.location.origin}/github-callback`, reason, state })
body: JSON.stringify({
code,
redirectUri: `${window.location.origin}/github-callback`,
reason,
state,
}),
})
const data = await res.json()
if (res.ok && data.token) {
@@ -28,27 +33,27 @@ export async function githubExchange(code, state, reason) {
registerPush()
return {
success: true,
needReason: false
needReason: false,
}
} else if (data.reason_code === 'NOT_APPROVED') {
toast.info('当前为注册审核模式,请填写注册理由')
return {
success: false,
needReason: true,
token: data.token
token: data.token,
}
} else if (data.reason_code === 'IS_APPROVING') {
toast.info('您的注册理由正在审批中')
return {
success: true,
needReason: false
needReason: false,
}
} else {
toast.error(data.error || '登录失败')
return {
success: false,
needReason: false,
error: data.error || '登录失败'
error: data.error || '登录失败',
}
}
} catch (e) {
@@ -56,7 +61,7 @@ export async function githubExchange(code, state, reason) {
return {
success: false,
needReason: false,
error: '登录失败'
error: '登录失败',
}
}
}