mirror of
https://gitee.com/h_mo/uniapp-vue3-vite-ts-template
synced 2025-04-06 03:58:03 +08:00
feat: 在生产环境中排除 mock 数据
This commit is contained in:
parent
a7c36064f5
commit
0598f3a09d
@ -1,6 +1,6 @@
|
|||||||
import { createAlova } from 'alova';
|
import { createAlova } from 'alova';
|
||||||
import AdapterUniapp from '@alova/adapter-uniapp';
|
import AdapterUniapp from '@alova/adapter-uniapp';
|
||||||
import { getBaseUrl } from '@/utils/env';
|
import { getBaseUrl, isDevMode } from '@/utils/env';
|
||||||
import { mockAdapter } from '@/mock';
|
import { mockAdapter } from '@/mock';
|
||||||
import { assign } from 'lodash-es';
|
import { assign } from 'lodash-es';
|
||||||
import { useAuthStore } from '@/state/modules/auth';
|
import { useAuthStore } from '@/state/modules/auth';
|
||||||
@ -24,7 +24,7 @@ const HEADER = {
|
|||||||
const alovaInstance = createAlova({
|
const alovaInstance = createAlova({
|
||||||
baseURL: BASE_URL,
|
baseURL: BASE_URL,
|
||||||
...AdapterUniapp({
|
...AdapterUniapp({
|
||||||
mockRequest: mockAdapter,
|
mockRequest: isDevMode() ? mockAdapter : undefined,
|
||||||
}),
|
}),
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
beforeRequest: (method) => {
|
beforeRequest: (method) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user