diff --git a/src/App.tsx b/src/App.tsx
index a5e4e85..7fdb635 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -23,6 +23,11 @@ const MainLayout = () => {
)
}
+const RootRedirect = () => {
+ const isAuthenticated = !!localStorage.getItem("accessToken")
+ return isAuthenticated ? :
+}
+
function App() {
return (
@@ -30,8 +35,8 @@ function App() {
- } />
- } />
+ } />
+ } />
} />
}>
diff --git a/src/api/client.ts b/src/api/client.ts
index 3ee0513..a22a2c0 100644
--- a/src/api/client.ts
+++ b/src/api/client.ts
@@ -23,7 +23,7 @@ export const authFetch = async (endpoint: string, options: RequestInit = {}) =>
if (response.status === 401) {
localStorage.removeItem("accessToken");
localStorage.removeItem("refreshToken");
- window.location.href = "/login";
+ window.location.href = "/auth";
}
return response;
diff --git a/src/api/users.ts b/src/api/users.ts
index 1314193..21925e8 100644
--- a/src/api/users.ts
+++ b/src/api/users.ts
@@ -3,7 +3,7 @@ import { authFetch } from './client';
// --- Auth Endpoints ---
export const loginWithPassword = async (mobile: string, password: string) => {
- const response = await authFetch('/api/users/login/', {
+ const response = await authFetch('/api/users/auth/', {
method: 'POST',
body: JSON.stringify({ mobile, password })
});
@@ -21,7 +21,7 @@ export const sendOtp = async (mobile: string, mode: string) => {
};
export const loginWithOtp = async (mobile: string, otp: string) => {
- const response = await authFetch('/api/users/otp/login/', {
+ const response = await authFetch('/api/users/otp/auth/', {
method: 'POST',
body: JSON.stringify({ mobile, otp })
});
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx
index 24f9a3f..8298725 100644
--- a/src/components/Navbar.tsx
+++ b/src/components/Navbar.tsx
@@ -71,7 +71,7 @@ export function Navbar() {
setUser(null)
setShowLogoutModal(false)
toast.success(t.logoutToast || "Successfully logged out!")
- navigate("/login")
+ navigate("/auth")
}
}
@@ -167,7 +167,7 @@ export function Navbar() {
<>