Skip to content

Commit

Permalink
fix service worker
Browse files Browse the repository at this point in the history
  • Loading branch information
DCKT committed Aug 22, 2023
1 parent d4cec2e commit 07a84d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/bindings/Msw.res
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ type worker
@module("msw") @variadic
external setupWorker: array<mock> => worker = "setupWorker"

type rec startOptions = {serviceWorker: serviceWorker}
and serviceWorker = {url: string}

@send
external start: worker => unit = "start"
external start: (worker, startOptions) => unit = "start"
@send
external stop: worker => unit = "stop"

Expand Down
6 changes: 5 additions & 1 deletion src/mocks/Mocks.res
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ let worker = Msw.setupWorker([
])

let init = () => {
worker->Msw.start
worker->Msw.start({
serviceWorker: {
url: "/colisweb-rescript-api-parse/mockServiceWorker.js",
},
})
}

0 comments on commit 07a84d0

Please sign in to comment.