bugfix(router): redirect to /workspaces if user is authenticated, otherwise redirect to /auth route + rename /login -> /auth
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 })
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user