-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ba2320
commit b1d4dfa
Showing
2 changed files
with
34 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
import { SetupWorkerApi } from 'msw'; | ||
|
||
export interface MSWToolbarProps { | ||
/** | ||
* A prefix will be prepended to the localStorage key we use for persisting settings. If you use this component | ||
* on many applications locally, you'll want to set this so configuration from app A doesn't impact app B. | ||
*/ | ||
prefix?: string; | ||
/** | ||
* The base url of your requests. This is required to use 'error' mode as it takes the base domain and intercepts any request regardless of the path. | ||
*/ | ||
apiUrl: string; | ||
/** | ||
* Actions can be useful for adding custom buttons/behaviors that might go along with MSW. If you're caching requests with RTK Query or react-query, | ||
* it would be useful to add an 'Invalidate Cache' button here. | ||
*/ | ||
actions?: React.ReactElement; | ||
/** | ||
* If the worker is not enabled, we won't ever load it and will just load children. | ||
*/ | ||
isEnabled?: boolean; | ||
/** | ||
* An instance of the MSW worker returned from `setupWorker`. | ||
*/ | ||
worker: SetupWorkerApi | undefined; | ||
/** | ||
* This component takes children so that it can ensure the worker has started before rendering the tree. This guarantees that | ||
* all requests will be intercepted. | ||
*/ | ||
children?: React.ReactNode; | ||
} | ||
|
||
export type Setting = 'mode' | 'delay' | 'status'; | ||
export type WorkerStatus = 'enabled' | 'disabled'; | ||
export type WorkerMode = 'normal' | 'error'; |