From 54be5515e5adb71f713bae13c669006baad3c79d Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 30 Nov 2024 20:21:19 +0100 Subject: [PATCH] Update API routes to target the default tenant --- app/api/expenses.tsx | 4 ++-- app/api/groups.tsx | 2 +- app/api/guests.tsx | 8 ++++---- app/api/tableSimulations.tsx | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/api/expenses.tsx b/app/api/expenses.tsx index f73f6b7..f384413 100644 --- a/app/api/expenses.tsx +++ b/app/api/expenses.tsx @@ -4,7 +4,7 @@ import { Expense } from '@/app/lib/definitions'; import { getCsrfToken } from '@/app/lib/utils'; export function loadExpenses(onLoad?: (expenses: Expense[]) => void) { - fetch("/api/expenses") + fetch("/api/default/expenses") .then((response) => response.json()) .then((data) => { onLoad && onLoad(data.map((record: any) => { @@ -21,7 +21,7 @@ export function loadExpenses(onLoad?: (expenses: Expense[]) => void) { } export function updateExpense(expense: Expense) { - fetch(`/api/expenses/${expense.id}`, + fetch(`/api/default/expenses/${expense.id}`, { method: 'PUT', body: JSON.stringify({ diff --git a/app/api/groups.tsx b/app/api/groups.tsx index aa0e4db..cf83904 100644 --- a/app/api/groups.tsx +++ b/app/api/groups.tsx @@ -3,7 +3,7 @@ import { Group } from '@/app/lib/definitions'; export function loadGroups(onLoad?: (groups: Group[]) => void) { - fetch("/api/groups") + fetch("/api/default/groups") .then((response) => response.json()) .then((data) => { onLoad && onLoad(data.map((record: any) => { diff --git a/app/api/guests.tsx b/app/api/guests.tsx index df218b4..628e7e5 100644 --- a/app/api/guests.tsx +++ b/app/api/guests.tsx @@ -4,7 +4,7 @@ import { Guest } from '@/app/lib/definitions'; import { getCsrfToken } from '@/app/lib/utils'; export function loadGuests(onLoad?: (guests: Guest[]) => void) { - fetch("/api/guests") + fetch("/api/default/guests") .then((response) => response.json()) .then((data) => { onLoad && onLoad(data.map((record: any) => { @@ -22,7 +22,7 @@ export function loadGuests(onLoad?: (guests: Guest[]) => void) { }; export function updateGuest(guest: Guest) { - return fetch(`/api/guests/${guest.id}`, + return fetch(`/api/default/guests/${guest.id}`, { method: 'PUT', body: JSON.stringify({ guest: { name: guest.name, status: guest.status } }), @@ -35,7 +35,7 @@ export function updateGuest(guest: Guest) { } export function createGuest(name: string, group_id: string, onCreate?: () => void) { - fetch("/api/guests", { + fetch("/api/default/guests", { method: 'POST', body: JSON.stringify({ name: name, group_id: group_id }), headers: { @@ -51,7 +51,7 @@ export function createGuest(name: string, group_id: string, onCreate?: () => voi } export function destroyGuest(guest: Guest, onDestroy?: () => void) { - fetch(`/api/guests/${guest.id}`, { + fetch(`/api/default/guests/${guest.id}`, { method: 'DELETE', headers: { 'X-CSRF-TOKEN': getCsrfToken(), diff --git a/app/api/tableSimulations.tsx b/app/api/tableSimulations.tsx index 4e28688..2072661 100644 --- a/app/api/tableSimulations.tsx +++ b/app/api/tableSimulations.tsx @@ -3,7 +3,7 @@ import { TableArrangement } from '@/app/lib/definitions'; export function loadTableSimulations(onLoad?: (tableSimulations: TableArrangement[]) => void) { - fetch('/api/tables_arrangements') + fetch('/api/default/tables_arrangements') .then((response) => response.json()) .then((data) => { onLoad && onLoad(data.map((record: any) => {