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
+10 -1
View File
@@ -2,6 +2,15 @@ import { supabase } from "./supabase";
const API_URL = process.env.EXPO_PUBLIC_API_URL ?? "http://localhost:3001";
export class ApiError extends Error {
status: number;
constructor(status: number, message: string) {
super(message);
this.status = status;
}
}
async function authHeaders(): Promise<Record<string, string>> {
const { data } = await supabase.auth.getSession();
const token = data.session?.access_token;
@@ -17,7 +26,7 @@ async function request<T>(path: string, options: RequestInit = {}): Promise<T> {
if (!res.ok) {
const body = await res.json().catch(() => ({ message: res.statusText }));
throw new Error(body.message ?? `Request failed: ${res.status}`);
throw new ApiError(res.status, body.message ?? `Request failed: ${res.status}`);
}
if (res.status === 204) return undefined as T;