mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use Next.js 13 App directory
This commit is contained in:
parent
cb3fc9a488
commit
379a0e9859
28 changed files with 418 additions and 295 deletions
|
|
@ -1,6 +1,7 @@
|
|||
"use client";
|
||||
import React, { useEffect } from "react";
|
||||
import { getRefreshToken, getUserInfo } from "../../services/auth/auth";
|
||||
import { useRouter } from "next/router";
|
||||
import { useRouter, usePathname } from "next/navigation";
|
||||
|
||||
export const AuthContext: any = React.createContext({});
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ export interface Auth {
|
|||
isLoading: boolean;
|
||||
}
|
||||
|
||||
const AuthProvider = (props: any) => {
|
||||
const AuthProvider = ({ children }: any) => {
|
||||
const router = useRouter();
|
||||
const [auth, setAuth] = React.useState<Auth>({ access_token: "", isAuthenticated: false, userInfo: {}, isLoading: true });
|
||||
|
||||
|
|
@ -55,7 +56,7 @@ const AuthProvider = (props: any) => {
|
|||
};
|
||||
}, []);
|
||||
|
||||
return <AuthContext.Provider value={auth}>{props.children}</AuthContext.Provider>;
|
||||
return <AuthContext.Provider value={auth}>{children}</AuthContext.Provider>;
|
||||
};
|
||||
|
||||
export default AuthProvider;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue