diff --git a/typings/auth.d.ts b/typings/auth.d.ts index 460bf04..a722c23 100644 --- a/typings/auth.d.ts +++ b/typings/auth.d.ts @@ -1,10 +1,60 @@ import { IUser } from "@models/user"; -import { SessionData as SDI } from "#auth"; +import { + GetSessionFunc, + SecondarySignInOptions, + SessionLastRefreshedAt, + SessionStatus, + SignInFunc, + SignOutFunc, +} from "@sidebase/nuxt-auth/dist/runtime/types"; +import { ComputedRef, Ref } from "vue"; declare module "#auth" { - export interface SessionData extends SDI { + interface SessionData { token?: string; user?: IUser; } - export type WrappedSessionData = SessionData; } + +declare module "@sidebase/nuxt-auth/dist/runtime/types" { + interface SessionData { + token?: string; + user?: IUser; + } + declare const signIn: SignInFunc; + declare const signOut: SignOutFunc; + declare const getSession: GetSessionFunc; + declare const signUp: ( + credentials: Credentials, + signInOptions?: SecondarySignInOptions, + ) => Promise; + + type WrappedSessionData = Ref; + export interface CommonUseAuthReturn< + SignIn, + SignOut, + GetSession, + SessionData, + > { + data: Readonly>; + lastRefreshedAt: Readonly>; + status: ComputedRef; + signIn: SignIn; + signOut: SignOut; + getSession: GetSession; + } + interface UseAuthReturn + extends CommonUseAuthReturn< + typeof signIn, + typeof signOut, + typeof getSession, + SessionData + > { + signUp: typeof signUp; + token: Readonly>; + } + + export declare const useAuth: () => UseAuthReturn; +} + +export {};