fix: 对接退出登录
This commit is contained in:
19
lib/auth.ts
19
lib/auth.ts
@@ -3,16 +3,15 @@ import 'reflect-metadata'
|
||||
import { expoClient } from '@better-auth/expo/client'
|
||||
import { createSkerClientPlugin } from '@repo/sdk'
|
||||
import {
|
||||
adminClient,
|
||||
emailOTPClient,
|
||||
genericOAuthClient,
|
||||
jwtClient,
|
||||
organizationClient,
|
||||
phoneNumberClient,
|
||||
usernameClient,
|
||||
adminClient,
|
||||
emailOTPClient,
|
||||
genericOAuthClient,
|
||||
jwtClient,
|
||||
organizationClient,
|
||||
phoneNumberClient,
|
||||
usernameClient,
|
||||
} from 'better-auth/client/plugins'
|
||||
import { createAuthClient } from 'better-auth/react'
|
||||
import Constants from 'expo-constants'
|
||||
|
||||
import { fetchWithLogger, TOKEN_KEY } from './fetch-logger'
|
||||
import type { Subscription } from './plugins/stripe'
|
||||
@@ -21,7 +20,7 @@ import { storage } from './storage'
|
||||
import type { ApiError } from './types'
|
||||
|
||||
// 商户ID配置 - 从环境变量或应用配置中读取
|
||||
const MERCHANT_ID = Constants.expoConfig?.extra?.merchantId || ''
|
||||
export const OWNER_ID = 't0m9cketSQdCA6cHXI9mXQLJPM9LDIw5'
|
||||
|
||||
export interface CreditBalance {
|
||||
tokenUsage: number
|
||||
@@ -92,7 +91,7 @@ export const authClient = createAuthClient({
|
||||
'Content-Type': 'application/json',
|
||||
// x-ownerid: 商户ID(如果后端需要)
|
||||
// 如果 MERCHANT_ID 为空,则不添加此 header
|
||||
...(MERCHANT_ID && { 'x-ownerid': MERCHANT_ID }),
|
||||
...(OWNER_ID && { 'x-ownerid': OWNER_ID }),
|
||||
},
|
||||
auth: {
|
||||
type: 'Bearer',
|
||||
|
||||
Reference in New Issue
Block a user