burdy
Version:
Open Source Headless Platform
50 lines (49 loc) • 1.43 kB
TypeScript
import { IUser, IUserToken } from '@shared/interfaces/model';
import React from 'react';
import { UseAsyncReturn } from 'react-async-hook';
export declare type AuthStatuses = 'authenticated' | 'needs-init' | 'unauthenticated';
interface AuthContextInterface {
user: IUser;
logIn: UseAsyncReturn<{
user: IUser;
token: IUserToken;
}, [
{
email: string;
password: string;
}
]>;
logOut: UseAsyncReturn<any, []>;
forgot: UseAsyncReturn<any, [{
email: string;
}]>;
forgotVerify: UseAsyncReturn<any, [{
token: string;
password: string;
}]>;
init: UseAsyncReturn<void, [
{
email: string;
password: string;
meta?: object;
}
]>;
updatePassword: UseAsyncReturn<any, [
{
currentPassword: string;
password: string;
confirmPassword: string;
}
]>;
filterPermissions: (list: any[]) => any[];
hasPermission: (list?: string[]) => boolean;
loading: boolean;
authStatus: AuthStatuses;
setAuthStatus: (status: AuthStatuses) => void;
}
declare const AuthContext: React.Context<AuthContextInterface>;
declare const AuthContextProvider: ({ children }: {
children: any;
}) => JSX.Element;
declare const useAuth: () => AuthContextInterface;
export { AuthContext, AuthContextProvider, useAuth };