From 07a84d07a40c572283fdf1da8eba2b3f3a361615 Mon Sep 17 00:00:00 2001 From: Thomas Deconinck Date: Tue, 22 Aug 2023 10:17:08 +0200 Subject: [PATCH] fix service worker --- src/bindings/Msw.res | 5 ++++- src/mocks/Mocks.res | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bindings/Msw.res b/src/bindings/Msw.res index 585e7b0..76dfbf2 100644 --- a/src/bindings/Msw.res +++ b/src/bindings/Msw.res @@ -4,8 +4,11 @@ type worker @module("msw") @variadic external setupWorker: array => 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" diff --git a/src/mocks/Mocks.res b/src/mocks/Mocks.res index 9e950e8..3a65ef1 100644 --- a/src/mocks/Mocks.res +++ b/src/mocks/Mocks.res @@ -24,5 +24,9 @@ let worker = Msw.setupWorker([ ]) let init = () => { - worker->Msw.start + worker->Msw.start({ + serviceWorker: { + url: "/colisweb-rescript-api-parse/mockServiceWorker.js", + }, + }) }