I'm trying to login using the msw library and following the Redux docs. Then I want to get the user auth token. I'm sending request for login but idk how to get auth token if logged in. Is the structure in the example correct for login? If not, how should it be
export const handlers = [
rest.post("/login", (req, res, ctx) => {
return res(
ctx.json({
id: "1234",
firstName: "John",
lastName: "Maverick",
})
);
})
const server = setupServer(...handlers);
// Enable API mocking before tests.
beforeAll(() => server.listen());
// Reset any runtime request handlers we may add during the tests.
afterEach(() => server.resetHandlers());
// Disable API mocking after the tests are done.
afterAll(() => server.close());