chore: request 添加运行时升级指引

This commit is contained in:
winixt 2024-01-18 19:38:00 +08:00
parent 32e221f150
commit 46e42d4344
4 changed files with 64 additions and 52 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@fesjs/plugin-request", "name": "@fesjs/plugin-request",
"version": "3.0.5", "version": "3.0.6",
"description": "@fesjs/plugin-request", "description": "@fesjs/plugin-request",
"main": "lib/index.js", "main": "lib/index.js",
"files": [ "files": [

View File

@ -49,6 +49,17 @@ function getRequestInstance() {
initialValue: {}, initialValue: {},
}); });
if (process.env.NODE_ENV === 'development') {
if (typeof errorHandler === 'object') {
console.error('[plugin-request]: errorHandler 更改为函数了,具体请看文档 https://fesjs.mumblefe.cn/reference/plugin/plugins/request.html');
}
if (otherConfigs.responseDataAdaptor) {
console.warn(
'[plugin-request]: responseDataAdaptor 在 3.x 已经被移除,请改用 dataHandler 实现,具体请看文档 https://fesjs.mumblefe.cn/reference/plugin/plugins/request.html',
);
}
}
const defaultConfig = Object.assign( const defaultConfig = Object.assign(
{ {
timeout: 10000, timeout: 10000,

View File

@ -1,52 +1,52 @@
{ {
"name": "@fesjs/template-h5", "name": "@fesjs/template-h5",
"version": "2.0.0", "version": "2.0.0",
"description": "fes 移动端项目模版", "description": "fes 移动端项目模版",
"scripts": { "scripts": {
"prod": "FES_ENV=prod fes build", "build": "FES_ENV=prod fes build",
"dev": "fes dev" "dev": "fes dev"
}, },
"keywords": [ "keywords": [
"管理端", "管理端",
"fes", "fes",
"fast", "fast",
"easy", "easy",
"strong" "strong"
], ],
"files": [ "files": [
".eslintrc.js", ".eslintrc.js",
".gitignore", ".gitignore",
".fes.js", ".fes.js",
".fes.prod.js", ".fes.prod.js",
"mock.js", "mock.js",
"package.json", "package.json",
"README.md", "README.md",
"tsconfig.json", "tsconfig.json",
"/src", "/src",
"/config" "/config"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/WeBankFinTech/fes.js.git", "url": "git+https://github.com/WeBankFinTech/fes.js.git",
"directory": "packages/fes-template-h5" "directory": "packages/fes-template-h5"
}, },
"author": "qlin", "author": "qlin",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/WeBankFinTech/fes.js/issues" "url": "https://github.com/WeBankFinTech/fes.js/issues"
}, },
"homepage": "https://github.com/WeBankFinTech/fes.js#readme", "homepage": "https://github.com/WeBankFinTech/fes.js#readme",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
"dependencies": { "dependencies": {
"@ttou/postcss-px-to-viewport": "^2.0.3", "@ttou/postcss-px-to-viewport": "^2.0.3",
"@fesjs/fes": "workspace:*", "@fesjs/fes": "workspace:*",
"@fesjs/plugin-icon": "workspace:*", "@fesjs/plugin-icon": "workspace:*",
"@fesjs/plugin-request": "workspace:*", "@fesjs/plugin-request": "workspace:*",
"@fesjs/builder-vite": "workspace:*", "@fesjs/builder-vite": "workspace:*",
"core-js": "^3.29.1", "core-js": "^3.29.1",
"vue": "^3.2.47" "vue": "^3.2.47"
}, },
"private": true "private": true
} }

View File

@ -3,6 +3,7 @@ import { defineRuntimeConfig } from '@fesjs/fes';
export default defineRuntimeConfig({ export default defineRuntimeConfig({
request: { request: {
baseURL: '/ras-mas', baseURL: '/ras-mas',
responseDataAdaptor() {},
dataHandler(data) { dataHandler(data) {
console.log('data', data); console.log('data', data);
if (data?.code !== '0') { if (data?.code !== '0') {