diff options
Diffstat (limited to 'src/mocks')
-rw-r--r-- | src/mocks/browser.ts | 4 | ||||
-rw-r--r-- | src/mocks/handlers.ts | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/mocks/browser.ts b/src/mocks/browser.ts new file mode 100644 index 0000000..0a56427 --- /dev/null +++ b/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/src/mocks/handlers.ts b/src/mocks/handlers.ts new file mode 100644 index 0000000..483da83 --- /dev/null +++ b/src/mocks/handlers.ts @@ -0,0 +1,18 @@ +import { http, HttpResponse } from 'msw'; +import { nanoid } from '@reduxjs/toolkit'; + +const token = nanoid(); + +export const handlers = [ + http.post('/guest-login', () => { + return HttpResponse.json( + { + user: { + firstName: 'Michael', + lastName: 'Hunteman' + }, + token + } + ) + }) +]; |