v1 review pass: fixed some minor bugs
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { type ReactNode, useState } from "react";
|
||||
|
||||
import { AuthContext, type AuthContextValue } from "./AuthContext.ts";
|
||||
|
||||
import { type AuthResponse } from "../model.ts";
|
||||
import { type AuthResponse, deserializeAuthResponse } from "../model.ts";
|
||||
|
||||
export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
const [authResponse, setAuthResponse] = useState<AuthResponse | null>(() => {
|
||||
const stored = localStorage.getItem("authResponse");
|
||||
|
||||
return stored ? JSON.parse(stored) : null;
|
||||
return stored ? deserializeAuthResponse(JSON.parse(stored)) : null;
|
||||
});
|
||||
|
||||
const value: AuthContextValue = { authResponse, setAuthResponse };
|
||||
|
||||
Reference in New Issue
Block a user