Extract APIs to their own files #108
| @ -3,7 +3,7 @@ | ||||
| import { Group } from '@/app/lib/definitions'; | ||||
| 
 | ||||
| export function loadGroups(onLoad?: (groups: Group[]) => void) { | ||||
|   fetch("/api/groups.json") | ||||
|   fetch("/api/groups") | ||||
|     .then((response) => response.json()) | ||||
|     .then((data) => { | ||||
|       onLoad && onLoad(data.map((record: any) => { | ||||
|  | ||||
| @ -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.json") | ||||
|   fetch("/api/guests") | ||||
|     .then((response) => response.json()) | ||||
|     .then((data) => { | ||||
|       onLoad && onLoad(data.map((record: any) => { | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { test, expect, Page } from '@playwright/test' | ||||
| 
 | ||||
| const mockGuestsAPI = ({ page }: { page: Page }) => { | ||||
|   page.route('*/**/api/guests.json', async route => { | ||||
|   page.route('*/**/api/guests', async route => { | ||||
|     const json = [ | ||||
|       { | ||||
|         "id": "f4a09c28-40ea-4553-90a5-96935a59cac6", | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user