2023-12-20 17:23:31 -05:00
|
|
|
import { IUser } from "@models/user";
|
2023-12-29 20:53:29 -05:00
|
|
|
import { GetSessionFunc, SecondarySignInOptions, SessionLastRefreshedAt, SessionStatus, SignInFunc, SignOutFunc } from "@sidebase/nuxt-auth/dist/runtime/types";
|
2023-12-29 18:11:51 -05:00
|
|
|
import { ComputedRef, Ref } from "vue";
|
2023-12-09 17:21:24 -05:00
|
|
|
|
|
|
|
declare module "#auth" {
|
2023-12-29 18:11:51 -05:00
|
|
|
interface SessionData {
|
2023-12-09 17:21:24 -05:00
|
|
|
token?: string;
|
|
|
|
user?: IUser;
|
|
|
|
}
|
|
|
|
}
|
2023-12-29 18:11:51 -05:00
|
|
|
|
|
|
|
declare module "@sidebase/nuxt-auth/dist/runtime/types" {
|
|
|
|
interface SessionData {
|
|
|
|
token?: string;
|
|
|
|
user?: IUser;
|
|
|
|
}
|
|
|
|
declare const signIn: SignInFunc<Credentials, any>;
|
|
|
|
declare const signOut: SignOutFunc;
|
|
|
|
declare const getSession: GetSessionFunc<SessionData | null | void>;
|
2023-12-29 20:53:29 -05:00
|
|
|
declare const signUp: (credentials: Credentials, signInOptions?: SecondarySignInOptions) => Promise<any>;
|
2023-12-29 18:11:51 -05:00
|
|
|
|
|
|
|
type WrappedSessionData<SessionData> = Ref<SessionData | null | undefined>;
|
2023-12-29 20:53:29 -05:00
|
|
|
export interface CommonUseAuthReturn<SignIn, SignOut, GetSession, SessionData> {
|
2023-12-29 18:11:51 -05:00
|
|
|
data: Readonly<WrappedSessionData<SessionData>>;
|
|
|
|
lastRefreshedAt: Readonly<Ref<SessionLastRefreshedAt>>;
|
|
|
|
status: ComputedRef<SessionStatus>;
|
|
|
|
signIn: SignIn;
|
|
|
|
signOut: SignOut;
|
|
|
|
getSession: GetSession;
|
|
|
|
}
|
2023-12-29 20:53:29 -05:00
|
|
|
interface UseAuthReturn extends CommonUseAuthReturn<typeof signIn, typeof signOut, typeof getSession, SessionData> {
|
2023-12-29 18:11:51 -05:00
|
|
|
signUp: typeof signUp;
|
|
|
|
token: Readonly<Ref<string | null>>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export declare const useAuth: () => UseAuthReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
export {};
|