refactor: enforce frontend view model boundaries
This commit is contained in:
@@ -11,13 +11,16 @@ type AuthContextValue = {
|
||||
register: (email: string, password: string) => Promise<void>;
|
||||
user: undefined | User;
|
||||
};
|
||||
|
||||
type User
|
||||
= paths["/api/v1/auth/me"]["get"]["responses"][200]["content"]["application/json"];
|
||||
|
||||
const AuthContext = createContext<AuthContextValue | undefined>(undefined);
|
||||
|
||||
function useAuth() {
|
||||
const context = use(AuthContext);
|
||||
if (!context) throw new Error("AuthProvider is required");
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user