You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
index.js:511 Uncaught (in promise) Error: [MSW] Failed to register a Service Worker for scope ('http://localhost:6006/') with script ('http://localhost:6006/mockServiceWorker.js'): Service Worker script does not exist at the given path.
Did you forget to run "npx msw init <PUBLIC_DIR>"?
Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init
at getWorkerInstance (index.js:511:1)
at async startWorkerInstance (index.js:1645:1)
I tried with Mock Service Worker and execute npx msw init public/ but doesnt work , the react query is work when the api is ON, but I need to creaate and put the mock
Please help me to create correct mock
my handler.ts : I tried to create mock in two ways but doesnt wotk this same handler I put in storybook but doens't work
import { graphql, rest } from 'msw'
/**
* a list of handlers (endpoints) to emulate (mock) a actual implementation
*/
export const handlers = [
graphql.query('listBanksAch', (req, res, ctx) => {
return res(
ctx.data({
tpAccounts: [
{
"id": 1,
"name": "Cuenta de ahorros"
},
{
"id": 2,
"name": "Cuenta Corriente"
},
]
}),
)
}),
rest.post("http://localhost:4005/graphql", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json([
{
"id": 1,
"name": "Cuenta de ahorros"
},
{
"id": 2,
"name": "Cuenta Corriente"
},
])
);
})
]
Sorry for my bad english but this answer doesn't work
my
preview.js
is thisbut the console in firefox and chrome said
I tried with Mock Service Worker and execute
npx msw init public/
but doesnt work , the react query is work when the api is ON, but I need to creaate and put the mockPlease help me to create correct mock
my
handler.ts
: I tried to create mock in two ways but doesnt wotk this same handler I put in storybook but doens't workMy component is :
the hook is next:
and storybook is
Why
mockServiceWorker
not read in the browser and how put mock in storybook? , thanksThe text was updated successfully, but these errors were encountered: