fix(app): dev-token 登录改走无鉴权通道(自拦 40100 鸡生蛋)

真机首验即中:loginByDevToken 走了带鉴权的 post(),而 ApiClient 对
未登录一律 40100 短路——登录接口被自己的守卫拦死,UI 表现为
「请先登录」且无解。改走既有 postWithoutAuth。编译门禁无法发现
此类运行时逻辑环,真机验证首个战果。
This commit is contained in:
xsl
2026-08-15 12:25:59 +08:00
parent e409ff08cc
commit dff8084bbb
+3 -1
View File
@@ -77,7 +77,9 @@ export class AuthStore {
/** dev-token 登录(本地后端开发通道)。失败由 ApiClient 抛 ApiError。 */ /** dev-token 登录(本地后端开发通道)。失败由 ApiClient 抛 ApiError。 */
static async loginByDevToken(deviceKey: string): Promise<void> { static async loginByDevToken(deviceKey: string): Promise<void> {
const req: Record<string, Object> = { 'device_key': deviceKey } const req: Record<string, Object> = { 'device_key': deviceKey }
const data = await ApiClient.post<AuthWireResp>('/api/v1/auth/dev-token', req) // 登录本身不能走带鉴权的 post()——ApiClient 对未登录一律 40100 短路,
// 登录接口会被自己的守卫拦死(鸡生蛋)。必须走无鉴权通道。
const data = await ApiClient.postWithoutAuth<AuthWireResp>('/api/v1/auth/dev-token', req)
await AuthStore.saveTokens(AuthStore.fromWire(data)) await AuthStore.saveTokens(AuthStore.fromWire(data))
} }