mirror of
https://github.com/20kaushik02/spotify-manager-web.git
synced 2025-12-06 08:04:06 +00:00
graph package (reactflow), updates. assets, some of the SEO. started with some basic components, login, navbar, etc.
23 lines
613 B
JavaScript
23 lines
613 B
JavaScript
import React, { useContext } from "react";
|
|
import { Navigate, Outlet, useLocation } from "react-router-dom";
|
|
|
|
import { AuthContext } from "../App";
|
|
import { showWarnToastNotification } from "../components/ToastNotification";
|
|
|
|
function UnAuthOnlyRoutes() {
|
|
let location = useLocation();
|
|
const auth = useContext(AuthContext);
|
|
|
|
const handleRouteRender = () => {
|
|
if (auth !== true) {
|
|
return <Outlet />;
|
|
} else {
|
|
showWarnToastNotification(<p>Already logged in!</p>);
|
|
return <Navigate to={"/graph"} state={{ from: location }} />;
|
|
}
|
|
};
|
|
|
|
return handleRouteRender();
|
|
}
|
|
|
|
export default UnAuthOnlyRoutes; |