-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from nuuxcode/ayoub
Fix import paths and remove unused code and
- Loading branch information
Showing
20 changed files
with
264 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from "react"; | ||
import { Navigate, Outlet } from "react-router-dom"; | ||
import { useAuth } from "../../hooks/useAuth"; | ||
|
||
const PrivateRoutes: React.FC = () => { | ||
const { user } = useAuth(); | ||
return <>{user?.accessToken ? <Outlet /> : <Navigate to="/login" />}</>; | ||
}; | ||
|
||
export default PrivateRoutes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useState } from "react"; | ||
import { User } from "../hooks/useUser"; | ||
// import { useAuth } from "../hooks/useAuth"; | ||
|
||
import { createContext, ReactNode } from "react"; | ||
|
||
interface AuthContext { | ||
user: User | null; | ||
setUser: (user: User | null) => void; | ||
} | ||
|
||
export const AuthContext = createContext<AuthContext>({} as AuthContext); | ||
|
||
export function AuthProvider({ children }: { children: ReactNode }) { | ||
const [user, setUser] = useState<User | null>(null); | ||
|
||
return ( | ||
<AuthContext.Provider value={{ user, setUser }}> | ||
{children} | ||
</AuthContext.Provider> | ||
); | ||
} |
Oops, something went wrong.