mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Enable msw file server for DoesItAPI
This commit is contained in:
parent
81340c5e97
commit
361350e5fa
1 changed files with 17 additions and 0 deletions
|
|
@ -15,6 +15,23 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
import { getApiUrl } from '~/helpers/url.js'
|
import { getApiUrl } from '~/helpers/url.js'
|
||||||
|
import { mswServer } from '~/test/msw/server.js'
|
||||||
|
|
||||||
|
|
||||||
|
const mswEnabled = process.env.NODE_ENV && [ 'development', 'test' ].includes( process.env.NODE_ENV )
|
||||||
|
|
||||||
|
// Inspired by https://github.com/wwdrew/examples/blob/react-native/examples/react-native/index.js
|
||||||
|
if ( mswEnabled ) {
|
||||||
|
// const { native } = require( '~/test/msw/native' )
|
||||||
|
// const { mswServer } = await import( '~/test/msw/server' )
|
||||||
|
|
||||||
|
// console.log({ mswServer })
|
||||||
|
|
||||||
|
mswServer.listen( {
|
||||||
|
// Fixes issue with MSW capturing POST http://192.168.1.90:19000/symbolicate
|
||||||
|
onUnhandledRequest: 'bypass',
|
||||||
|
} )
|
||||||
|
}
|
||||||
|
|
||||||
// const defaultFetchMethod = (...args) => console.log(...args) // mock
|
// const defaultFetchMethod = (...args) => console.log(...args) // mock
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue