bananas-commerce-admin
Version:
What's this, an admin for apes?
25 lines (24 loc) • 847 B
TypeScript
import React from "react";
export interface User {
id: string;
email: string;
is_superuser: boolean;
groups: string[];
full_name: string;
username: string;
permissions: string[];
}
interface UserContext {
user: User | null | undefined;
login: (username: string, password: string) => Promise<User | null>;
logout: () => Promise<void>;
changePassword: (oldPassword: string, newPassword1: string, newPassword2: string) => Promise<void>;
/**
* Horrid name! This is to prevent a flash of loginscreen or ui when getting an already logged in user.
*/
hasTriedToFetchUser: boolean;
}
declare const UserContext: React.Context<UserContext>;
export declare const useUser: () => UserContext;
export declare const UserContextProvider: React.FC<React.PropsWithChildren>;
export default UserContext;