fix: add /mobile prefix to all client-side fetch() calls for basePath
This commit is contained in:
@@ -69,7 +69,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
|
||||
const fetchUser = async (t: string) => {
|
||||
try {
|
||||
const res = await fetch("/api/auth/me", {
|
||||
const res = await fetch("/mobile/api/auth/me", {
|
||||
headers: { Authorization: `Bearer ${t}` },
|
||||
});
|
||||
if (res.ok) {
|
||||
@@ -87,7 +87,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
};
|
||||
|
||||
const login = useCallback(async (email: string, password: string) => {
|
||||
const res = await fetch("/api/auth/login", {
|
||||
const res = await fetch("/mobile/api/auth/login", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ email, password }),
|
||||
@@ -103,7 +103,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
}, []);
|
||||
|
||||
const register = useCallback(async (email: string, name: string, password: string) => {
|
||||
const res = await fetch("/api/auth/register", {
|
||||
const res = await fetch("/mobile/api/auth/register", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ email, name, password }),
|
||||
@@ -134,7 +134,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
const refreshStreak = useCallback(async () => {
|
||||
if (!token) return;
|
||||
try {
|
||||
const res = await fetch("/api/gamification/streak", {
|
||||
const res = await fetch("/mobile/api/gamification/streak", {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (res.ok) {
|
||||
@@ -149,7 +149,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
const refreshXp = useCallback(async () => {
|
||||
if (!token) return;
|
||||
try {
|
||||
const res = await fetch("/api/gamification/xp", {
|
||||
const res = await fetch("/mobile/api/gamification/xp", {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user