fix: add /mobile prefix to all client-side fetch() calls for basePath

This commit is contained in:
root
2026-06-15 11:38:03 +02:00
parent 15300d3e42
commit 947fe3b66d
13 changed files with 29 additions and 29 deletions
+1 -1
View File
@@ -133,7 +133,7 @@ export default function ThreadDetailPage() {
setSubmitting(true);
try {
const res = await fetch("/api/forum/posts", {
const res = await fetch("/mobile/api/forum/posts", {
method: "POST",
headers: {
"Content-Type": "application/json",
+2 -2
View File
@@ -87,7 +87,7 @@ export default function ForumPage() {
const fetchCategories = useCallback(async () => {
try {
const res = await fetch("/api/forum/categories");
const res = await fetch("/mobile/api/forum/categories");
const data = await res.json();
if (res.ok) {
setCategories(data.categories);
@@ -159,7 +159,7 @@ export default function ForumPage() {
setCreating(true);
try {
const res = await fetch("/api/forum/threads", {
const res = await fetch("/mobile/api/forum/threads", {
method: "POST",
headers: {
"Content-Type": "application/json",
+4 -4
View File
@@ -100,7 +100,7 @@ export default function HalalMonitorPage() {
const fetchUsage = useCallback(async () => {
if (!token) return;
try {
const res = await fetch("/api/halal/usage", {
const res = await fetch("/mobile/api/halal/usage", {
headers: { Authorization: `Bearer ${token}` },
});
if (res.ok) {
@@ -116,7 +116,7 @@ export default function HalalMonitorPage() {
const fetchBookmarks = useCallback(async () => {
if (!token) return;
try {
const res = await fetch("/api/halal/bookmarks", {
const res = await fetch("/mobile/api/halal/bookmarks", {
headers: { Authorization: `Bearer ${token}` },
});
if (res.ok) {
@@ -133,7 +133,7 @@ export default function HalalMonitorPage() {
if (!token) return;
setUsageLoading(true);
try {
const res = await fetch("/api/halal/usage", {
const res = await fetch("/mobile/api/halal/usage", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
@@ -198,7 +198,7 @@ export default function HalalMonitorPage() {
});
if (res.ok) fetchBookmarks();
} else {
const res = await fetch("/api/halal/bookmarks", {
const res = await fetch("/mobile/api/halal/bookmarks", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
+2 -2
View File
@@ -77,7 +77,7 @@ function NurChat() {
fetch(`/api/chat/history/${user.id}`, {
headers: { Authorization: `Bearer ${token}` },
}),
fetch("/api/chat/daily", {
fetch("/mobile/api/chat/daily", {
headers: { Authorization: `Bearer ${token}` },
}),
]);
@@ -127,7 +127,7 @@ function NurChat() {
setIsTyping(true);
try {
const res = await fetch("/api/chat/send", {
const res = await fetch("/mobile/api/chat/send", {
method: "POST",
headers: {
"Content-Type": "application/json",
+1 -1
View File
@@ -39,7 +39,7 @@ export default function HomePage() {
setClaiming(true);
setClaimResult(null);
try {
const res = await fetch("/api/gamification/streak", {
const res = await fetch("/mobile/api/gamification/streak", {
method: "POST",
headers: { Authorization: `Bearer ${token}` },
});
+1 -1
View File
@@ -66,7 +66,7 @@ export default function ProfilePage() {
setSaveMessage("");
try {
const res = await fetch("/api/auth/profile", {
const res = await fetch("/mobile/api/auth/profile", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
+2 -2
View File
@@ -144,7 +144,7 @@ export default function SouqPage() {
return;
}
const res = await fetch("/api/marketplace/listings", {
const res = await fetch("/mobile/api/marketplace/listings", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -185,7 +185,7 @@ export default function SouqPage() {
setPurchaseResult(null);
try {
const res = await fetch("/api/marketplace/purchase", {
const res = await fetch("/mobile/api/marketplace/purchase", {
method: "POST",
headers: {
"Content-Type": "application/json",
+2 -2
View File
@@ -112,7 +112,7 @@ function UpgradeContent() {
window.history.replaceState({}, "", newUrl);
// Refresh user data
if (token) {
fetch("/api/auth/me", {
fetch("/mobile/api/auth/me", {
headers: { Authorization: `Bearer ${token}` },
})
.then((r) => r.json())
@@ -142,7 +142,7 @@ function UpgradeContent() {
setMessage(null);
try {
const res = await fetch("/api/upgrade/create-checkout", {
const res = await fetch("/mobile/api/upgrade/create-checkout", {
method: "POST",
headers: {
"Content-Type": "application/json",
+3 -3
View File
@@ -66,7 +66,7 @@ export default function WalletPage() {
const fetchWallet = async () => {
try {
const res = await fetch("/api/wallet", {
const res = await fetch("/mobile/api/wallet", {
headers: { Authorization: `Bearer ${token}` },
});
if (res.ok) {
@@ -84,7 +84,7 @@ export default function WalletPage() {
setTopupLoading(amount);
try {
const res = await fetch("/api/wallet/top-up/create-checkout", {
const res = await fetch("/mobile/api/wallet/top-up/create-checkout", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -139,7 +139,7 @@ export default function WalletPage() {
setCashoutMessage(null);
try {
const res = await fetch("/api/wallet", {
const res = await fetch("/mobile/api/wallet", {
method: "POST",
headers: {
"Content-Type": "application/json",
+1 -1
View File
@@ -14,7 +14,7 @@ export default function NotificationBell() {
const fetchUnreadCount = async () => {
if (!token) return;
try {
const res = await fetch("/api/notifications/unread-count", {
const res = await fetch("/mobile/api/notifications/unread-count", {
headers: { Authorization: `Bearer ${token}` },
});
if (res.ok) {
+4 -4
View File
@@ -65,7 +65,7 @@ export default function NotificationPanel({
const fetchNotifications = useCallback(async () => {
if (!token) return;
try {
const res = await fetch("/api/notifications", {
const res = await fetch("/mobile/api/notifications", {
headers: { Authorization: `Bearer ${token}` },
});
if (res.ok) {
@@ -86,7 +86,7 @@ export default function NotificationPanel({
const markAsRead = async (id: string) => {
if (!token) return;
try {
const res = await fetch("/api/notifications", {
const res = await fetch("/mobile/api/notifications", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
@@ -108,7 +108,7 @@ export default function NotificationPanel({
const markAllAsRead = async () => {
if (!token) return;
try {
const res = await fetch("/api/notifications", {
const res = await fetch("/mobile/api/notifications", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
@@ -130,7 +130,7 @@ export default function NotificationPanel({
const refreshCount = async () => {
if (!token) return;
try {
const res = await fetch("/api/notifications/unread-count", {
const res = await fetch("/mobile/api/notifications/unread-count", {
headers: { Authorization: `Bearer ${token}` },
});
if (res.ok) {
+5 -5
View File
@@ -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) {
+1 -1
View File
@@ -3,7 +3,7 @@ export async function generateAIResponse(
personaId: string,
token: string
): Promise<Response> {
return fetch("/api/chat/send", {
return fetch("/mobile/api/chat/send", {
method: "POST",
headers: {
"Content-Type": "application/json",