fix(mobile): update public menu URL format to https://menul.io/menu/:slug

This commit is contained in:
AyrisAI
2026-08-20 04:32:25 +03:00
parent c6b15ffa52
commit 93b2a77127
4 changed files with 29 additions and 11 deletions
+15 -2
View File
@@ -1,8 +1,8 @@
import { useEffect, useState } from "react";
import { router } from "expo-router";
import { ActivityIndicator, View } from "react-native";
import { api } from "@/lib/api";
import { getActiveRestaurant, setActiveRestaurant } from "@/lib/active-restaurant";
import { api, ApiError } from "@/lib/api";
import { clearActiveRestaurant, getActiveRestaurant, setActiveRestaurant } from "@/lib/active-restaurant";
import { supabase } from "@/lib/supabase";
interface MeRestaurantResponse {
@@ -55,6 +55,19 @@ export default function Index() {
}
} catch (e) {
console.warn("Index resolve error:", e);
// A 401 here means the cached session's token is no longer valid
// server-side (expired refresh token, deleted user, etc.) — that is
// not the same as "no restaurant yet", so send them to login instead
// of silently starting onboarding with a broken session.
if (e instanceof ApiError && e.status === 401) {
await clearActiveRestaurant();
await supabase.auth.signOut();
if (!cancelled) {
router.replace("/(auth)/login");
}
return;
}
}
if (!cancelled) {