fix: add /mobile prefix to all client-side fetch() calls for basePath
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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}`,
|
||||
|
||||
@@ -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
@@ -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}` },
|
||||
});
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user