diff options
author | Michael Hunteman <michael@huntm.net> | 2024-05-17 15:20:30 -0700 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-05-17 15:20:30 -0700 |
commit | 7103019890960e793deefb64987a09b33be60b42 (patch) | |
tree | c1c9402aa250c68b2cbe13d62598232bbf20b1e2 /client/src/mocks | |
parent | fc5c111bcfe296bec82e1cf9fdb88fc80fb24f89 (diff) |
Add golang server
Diffstat (limited to 'client/src/mocks')
-rw-r--r-- | client/src/mocks/browser.ts | 4 | ||||
-rw-r--r-- | client/src/mocks/handlers.ts | 30 |
2 files changed, 34 insertions, 0 deletions
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: '', + }); + }), +]; |