31 lines
953 B
TypeScript
31 lines
953 B
TypeScript
import { expoClient } from "@better-auth/expo/client";
|
|
import { stripeClient } from "@bowong/better-auth-stripe/client";
|
|
import { usernameClient } from "better-auth/client/plugins";
|
|
import { createAuthClient } from "better-auth/react";
|
|
import { storage } from '../storage';
|
|
import { getAuthToken, loomartClient } from "../api/loomart-client";
|
|
|
|
export const authClient = createAuthClient({
|
|
baseURL: "https://api.mixvideo.bowong.cc/api/auth",
|
|
disableDefaultFetchPlugins: true,
|
|
fetchOptions: {
|
|
auth: {
|
|
type: 'Bearer', token: async () => {
|
|
const Authorization = await getAuthToken()
|
|
return Authorization;
|
|
}
|
|
}
|
|
},
|
|
plugins: [
|
|
expoClient({
|
|
scheme: "bestaibestwebapp",
|
|
storagePrefix: "bestaibest",
|
|
storage: storage as any,
|
|
}),
|
|
usernameClient(),
|
|
stripeClient({ subscription: true }),
|
|
],
|
|
});
|
|
|
|
export const { signIn, signUp, signOut, useSession, $Infer, subscription } = authClient;
|