配置 mdx 与 turbopack 继承;修复退出登录后循环跳转的问题;button 统一复用可导出样式并微调样式

This commit is contained in:
2025-06-06 16:17:33 +08:00
parent 7fff0308d0
commit ce4f7e272c
11 changed files with 175 additions and 68 deletions

View File

@@ -44,7 +44,6 @@ const _callByDevice = cache(async <R = undefined>(
endpoint: string,
data?: string,
): Promise<ApiResponse<R>> => {
// 获取设备令牌
if (!CLIENT_ID || !CLIENT_SECRET) {
return {
@@ -74,7 +73,7 @@ async function callByUser<R = undefined>(
endpoint: string,
data?: unknown,
): Promise<ApiResponse<R>> {
return postCall(_callByUser(endpoint, data ? JSON.stringify(data) : undefined))
return _callByUser(endpoint, data ? JSON.stringify(data) : undefined)
}
const _callByUser = cache(async <R = undefined>(
@@ -107,7 +106,6 @@ const _callByUser = cache(async <R = undefined>(
})
})
// ======================
// call
// ======================
@@ -150,7 +148,7 @@ async function call<R = undefined>(url: string, request: RequestInit): Promise<A
return {
success: false,
status: response.status,
message: json.message || json.error_description || '请求失败' // 业务错误message或者 oauth 错误error_description
message: json.message || json.error_description || '请求失败', // 业务错误message或者 oauth 错误error_description
}
}
return {
@@ -162,7 +160,6 @@ async function call<R = undefined>(url: string, request: RequestInit): Promise<A
throw new Error(`无法解析响应数据,未处理的 Content-Type: ${type}`)
}
async function postCall<R = undefined>(rawResp: Promise<ApiResponse<R>>) {
const header = await headers()
const pathname = header.get('x-pathname') || '/'