add new environment variable to control "quiet" option of msw

This commit is contained in:
Jacob Overgaard
2023-02-01 10:13:49 +01:00
parent e7a33cf446
commit bdad73f230
3 changed files with 3 additions and 0 deletions

View File

@@ -2,3 +2,4 @@
VITE_UMBRACO_USE_MSW=on # on = turns on MSW, off = disables all mock handlers
VITE_UMBRACO_API_URL=http://localhost:11000
VITE_UMBRACO_INSTALL_STATUS=running # running or must-install or must-upgrade
VITE_MSW_QUIET=off # on = turns off MSW console logs, off = turns on MSW console logs

View File

@@ -16,4 +16,5 @@ export const onUnhandledRequest = (req: MockedRequest) => {
export const startMockServiceWorker = () =>
worker.start({
onUnhandledRequest,
quiet: import.meta.env.VITE_MSW_QUIET === 'on',
});

View File

@@ -4,4 +4,5 @@ interface ImportMetaEnv {
VITE_UMBRACO_INSTALL_STATUS: 'running' | 'must-upgrade' | 'must-install';
VITE_UMBRACO_API_URL: string;
VITE_UMBRACO_USE_MSW: 'on' | 'off';
VITE_MSW_QUIET: 'on' | 'off';
}