Update API routes to target the default tenant #126

Merged
bustikiller merged 2 commits from default-tenant into main 2024-11-30 20:01:23 +00:00
4 changed files with 8 additions and 8 deletions
Showing only changes of commit 54be5515e5 - Show all commits

View File

@ -4,7 +4,7 @@ import { Expense } from '@/app/lib/definitions';
import { getCsrfToken } from '@/app/lib/utils'; import { getCsrfToken } from '@/app/lib/utils';
export function loadExpenses(onLoad?: (expenses: Expense[]) => void) { export function loadExpenses(onLoad?: (expenses: Expense[]) => void) {
fetch("/api/expenses") fetch("/api/default/expenses")
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
onLoad && onLoad(data.map((record: any) => { onLoad && onLoad(data.map((record: any) => {
@ -21,7 +21,7 @@ export function loadExpenses(onLoad?: (expenses: Expense[]) => void) {
} }
export function updateExpense(expense: Expense) { export function updateExpense(expense: Expense) {
fetch(`/api/expenses/${expense.id}`, fetch(`/api/default/expenses/${expense.id}`,
{ {
method: 'PUT', method: 'PUT',
body: JSON.stringify({ body: JSON.stringify({

View File

@ -3,7 +3,7 @@
import { Group } from '@/app/lib/definitions'; import { Group } from '@/app/lib/definitions';
export function loadGroups(onLoad?: (groups: Group[]) => void) { export function loadGroups(onLoad?: (groups: Group[]) => void) {
fetch("/api/groups") fetch("/api/default/groups")
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
onLoad && onLoad(data.map((record: any) => { onLoad && onLoad(data.map((record: any) => {

View File

@ -4,7 +4,7 @@ import { Guest } from '@/app/lib/definitions';
import { getCsrfToken } from '@/app/lib/utils'; import { getCsrfToken } from '@/app/lib/utils';
export function loadGuests(onLoad?: (guests: Guest[]) => void) { export function loadGuests(onLoad?: (guests: Guest[]) => void) {
fetch("/api/guests") fetch("/api/default/guests")
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
onLoad && onLoad(data.map((record: any) => { onLoad && onLoad(data.map((record: any) => {
@ -22,7 +22,7 @@ export function loadGuests(onLoad?: (guests: Guest[]) => void) {
}; };
export function updateGuest(guest: Guest) { export function updateGuest(guest: Guest) {
return fetch(`/api/guests/${guest.id}`, return fetch(`/api/default/guests/${guest.id}`,
{ {
method: 'PUT', method: 'PUT',
body: JSON.stringify({ guest: { name: guest.name, status: guest.status } }), 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) { export function createGuest(name: string, group_id: string, onCreate?: () => void) {
fetch("/api/guests", { fetch("/api/default/guests", {
method: 'POST', method: 'POST',
body: JSON.stringify({ name: name, group_id: group_id }), body: JSON.stringify({ name: name, group_id: group_id }),
headers: { headers: {
@ -51,7 +51,7 @@ export function createGuest(name: string, group_id: string, onCreate?: () => voi
} }
export function destroyGuest(guest: Guest, onDestroy?: () => void) { export function destroyGuest(guest: Guest, onDestroy?: () => void) {
fetch(`/api/guests/${guest.id}`, { fetch(`/api/default/guests/${guest.id}`, {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'X-CSRF-TOKEN': getCsrfToken(), 'X-CSRF-TOKEN': getCsrfToken(),

View File

@ -3,7 +3,7 @@
import { TableArrangement } from '@/app/lib/definitions'; import { TableArrangement } from '@/app/lib/definitions';
export function loadTableSimulations(onLoad?: (tableSimulations: TableArrangement[]) => void) { export function loadTableSimulations(onLoad?: (tableSimulations: TableArrangement[]) => void) {
fetch('/api/tables_arrangements') fetch('/api/default/tables_arrangements')
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
onLoad && onLoad(data.map((record: any) => { onLoad && onLoad(data.map((record: any) => {