From c5a277365f8f00277ee7bc573cd73ca393d6d2ae Mon Sep 17 00:00:00 2001 From: yuping <82253452@qq.com> Date: Tue, 20 Dec 2022 00:51:51 +0800 Subject: [PATCH] -- url --- src/api/request.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/api/request.js b/src/api/request.js index d741c2df..e682b2e1 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -1,8 +1,9 @@ -import { reactive, ref, toRefs, watch } from "vue"; -import { getCookie } from "@/api/method"; +import {reactive, ref, toRefs, watch} from "vue"; +import {getCookie} from "@/api/method"; import JSONBigInt from 'json-bigint'; -const JSONBigIntStr = JSONBigInt({ storeAsString: true }); +const JSONBigIntStr = JSONBigInt({storeAsString: true}); + export function useBoeApiPage(_url, params = {}, config = { init: true, result: res => res.result, @@ -138,14 +139,14 @@ export async function request(_url, params) { } } const body = method !== 'get' ? params || {} : {} - url = process.env.VUE_APP_BOE_API_URL + url + url = process.env.NODE_ENV === 'development' ? url : process.env.VUE_APP_BOE_API_URL + url return fetch(url, { method, headers: { token: getCookie('token'), - ...method !== 'get' ? { 'Content-Type': 'application/json' } : {} + ...method !== 'get' ? {'Content-Type': 'application/json'} : {} }, - ...method !== 'get' ? { body: JSON.stringify(body) } : {} + ...method !== 'get' ? {body: JSON.stringify(body)} : {} }).then(res => { return res.text() }).then(res => {