Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/src/Context/UserContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const UserContextProvider = ({ children }) => {
const getUser = async () => {
const token = localStorage.getItem("token");

// If no token and not on a public route, redirect to login
if (!token) {
// If no token (or invalid string "null"/"undefined") and not on a public route, redirect to login
if (!token || token === "null" || token === "undefined") {
if (!isPublicRoute) {
navigate("/login");
}
Expand Down
Loading