diff options
author | Michael Hunteman <michael@huntm.net> | 2024-02-24 10:04:10 -0600 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-02-24 10:18:33 -0600 |
commit | 68a86b2f9c41717767443b6b9e1860cb73b2aa30 (patch) | |
tree | 33c8d6033a26ec70a1e116d2e1669f2dc12b3744 /src/mocks | |
parent | 589e53f152d7363074049dfd1bd5a34286ae74d6 (diff) |
Use RTK query
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 + } + ) + }) +]; |