diff options
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: '', + }); + }), +]; |