removed unneeded user functions
This commit is contained in:
@@ -14,7 +14,7 @@ const LoginPage = () => {
|
||||
const [password, setPassword] = useState("");
|
||||
const [verifyPassword, setVerifyPassword] = useState("");
|
||||
const [mode, setMode] = useState<"login" | "create" | "reset">("login");
|
||||
const [attemptingLogin, setAttemptingLogin] = useState(false);
|
||||
const [attemptingLogin, setAttemptingLogin] = useState(true);
|
||||
const [loadingLogin, setLoadingLogin] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const dispatch = useAppDispatch();
|
||||
@@ -30,7 +30,6 @@ const LoginPage = () => {
|
||||
const redirectPath = location.state?.from?.pathname || "/home";
|
||||
dispatch(setUser(userResponse));
|
||||
navigate(redirectPath);
|
||||
setAttemptingLogin(false);
|
||||
window.localStorage.setItem("hasPreviouslyLoggedIn", "true");
|
||||
} catch (e) {
|
||||
setAttemptingLogin(false);
|
||||
@@ -122,7 +121,12 @@ const LoginPage = () => {
|
||||
}, [mode, email, password, verifyPassword]);
|
||||
|
||||
useEffect(() => {
|
||||
attemptLoginWithToken();
|
||||
const loggedIn = window.localStorage.getItem("hasPreviouslyLoggedIn");
|
||||
if (loggedIn === "true") {
|
||||
attemptLoginWithToken();
|
||||
} else {
|
||||
setAttemptingLogin(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
if (attemptingLogin) {
|
||||
|
||||
@@ -57,14 +57,6 @@ const SettingsPage = () => {
|
||||
setShowSidebarMobile(false);
|
||||
};
|
||||
|
||||
if (!user) {
|
||||
return (
|
||||
<div className="w-screen h-screen flex justify-center items-center">
|
||||
<Spinner />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="hidden sm:block">
|
||||
@@ -115,16 +107,23 @@ const SettingsPage = () => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-6 px-2 sm:px-64 w-full">
|
||||
<div className="block sm:hidden mb-2">
|
||||
<MenuIcon
|
||||
className="w-8 h-8"
|
||||
onClick={() => setShowSidebarMobile(!showSidebarMobile)}
|
||||
/>
|
||||
{user && (
|
||||
<div className="mt-6 px-2 sm:px-64 w-full">
|
||||
<div className="block sm:hidden mb-2">
|
||||
<MenuIcon
|
||||
className="w-8 h-8"
|
||||
onClick={() => setShowSidebarMobile(!showSidebarMobile)}
|
||||
/>
|
||||
</div>
|
||||
{tab === "account" && <SettingsAccountSection user={user} />}
|
||||
{tab === "general" && <SettingsGeneralSection />}
|
||||
</div>
|
||||
{tab === "account" && <SettingsAccountSection user={user} />}
|
||||
{tab === "general" && <SettingsGeneralSection />}
|
||||
</div>
|
||||
)}
|
||||
{!user && (
|
||||
<div className="w-full h-screen flex justify-center items-center">
|
||||
<Spinner />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<ToastContainer position="bottom-left" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user