From 7103019890960e793deefb64987a09b33be60b42 Mon Sep 17 00:00:00 2001 From: Michael Hunteman Date: Fri, 17 May 2024 15:20:30 -0700 Subject: Add golang server --- client/src/mocks/browser.ts | 4 ++++ client/src/mocks/handlers.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 client/src/mocks/browser.ts create mode 100644 client/src/mocks/handlers.ts (limited to 'client/src/mocks') diff --git a/client/src/mocks/browser.ts b/client/src/mocks/browser.ts new file mode 100644 index 0000000..0a56427 --- /dev/null +++ b/client/src/mocks/browser.ts @@ -0,0 +1,4 @@ +import { setupWorker } from 'msw/browser'; +import { handlers } from './handlers'; + +export const worker = setupWorker(...handlers); diff --git a/client/src/mocks/handlers.ts b/client/src/mocks/handlers.ts new file mode 100644 index 0000000..217a7d5 --- /dev/null +++ b/client/src/mocks/handlers.ts @@ -0,0 +1,30 @@ +import { http, HttpResponse } from 'msw'; +import { nanoid } from '@reduxjs/toolkit'; + +const token = nanoid(); + +export const handlers = [ + http.post('/guest-login', () => { + return HttpResponse.json({ + guest: { + id: 1, + firstName: 'Michael', + lastName: 'Hunteman', + attendance: 'false', + email: '', + message: '', + }, + token, + }); + }), + http.patch('/guests/1', () => { + return HttpResponse.json({ + id: 1, + firstName: 'Michael', + lastName: 'Hunteman', + attendance: 'true', + email: '', + message: '', + }); + }), +]; -- cgit v1.2.3