chore: finish frontend ESLint migration #18
Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
import { createContext, useContext } from "react";
|
||||
import { createContext, use } from "react";
|
||||
|
||||
import type { paths } from "@/shared/api";
|
||||
|
||||
type User =
|
||||
paths["/api/v1/auth/me"]["get"]["responses"][200]["content"]["application/json"];
|
||||
type AuthContextValue = {
|
||||
user: User | null;
|
||||
accessToken: string | null;
|
||||
ready: boolean;
|
||||
accessToken: string | undefined;
|
||||
login: (email: string, password: string) => Promise<void>;
|
||||
register: (email: string, password: string) => Promise<void>;
|
||||
logout: () => Promise<void>;
|
||||
ready: boolean;
|
||||
refresh: () => Promise<boolean>;
|
||||
register: (email: string, password: string) => Promise<void>;
|
||||
user: undefined | User;
|
||||
};
|
||||
const AuthContext = createContext<AuthContextValue | null>(null);
|
||||
type User
|
||||
= paths["/api/v1/auth/me"]["get"]["responses"][200]["content"]["application/json"];
|
||||
const AuthContext = createContext<AuthContextValue | undefined>(undefined);
|
||||
|
||||
function useAuth() {
|
||||
const context = useContext(AuthContext);
|
||||
const context = use(AuthContext);
|
||||
if (!context) throw new Error("AuthProvider is required");
|
||||
return context;
|
||||
}
|
||||
|
||||
export { AuthContext, type User, useAuth };
|
||||
export { AuthContext, useAuth, type User };
|
||||
|
||||
Reference in New Issue
Block a user