Skip to content

Commit

Permalink
fix: repair local development post request proxy to https error probl…
Browse files Browse the repository at this point in the history
…em (#63)
  • Loading branch information
anncwb committed Oct 28, 2020
1 parent 06e1d38 commit 34c09fc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions .env.development
Expand Up @@ -6,6 +6,7 @@ VITE_PUBLIC_PATH = /

# Cross-domain proxy, you can configure multiple
VITE_PROXY=[["/api","http://localhost:3000"]]
# VITE_PROXY=[["/api","https://vvbin.cn/test"]]

# Delete console
VITE_DROP_CONSOLE = false
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.zh_CN.md
@@ -1,3 +1,9 @@
## Wip

### 🐛 Bug Fixes

- 修复本地代理 post 接口到 https 地址超时错误

## 2.0.0-rc.6 (2020-10-28)

### ✨ Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -89,7 +89,7 @@
"ts-node": "^9.0.0",
"typescript": "^4.0.5",
"vite-plugin-html": "^1.0.0-beta.2",
"vite-plugin-mock": "^1.0.4",
"vite-plugin-mock": "^1.0.6",
"vite-plugin-purge-icons": "^0.4.4",
"vite-plugin-pwa": "^0.1.2",
"vue-eslint-parser": "^7.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Expand Up @@ -20,7 +20,7 @@
moment.locale('zh-cn');
export default defineComponent({
name: 'App1',
name: 'App',
components: { ConfigProvider },
setup() {
useInitAppConfigStore();
Expand Down
6 changes: 3 additions & 3 deletions src/utils/http/axios/index.ts
Expand Up @@ -116,20 +116,20 @@ const transform: AxiosTransform = {
} else {
// 兼容restful风格
config.url = config.url + config.params + `?_t=${now}`;
config.params = {};
config.params = undefined;
}
} else {
if (!isString(config.params)) {
formatDate && formatRequestDate(config.params);
config.data = config.params;
config.params = {};
config.params = undefined;
if (joinParamsToUrl) {
config.url = setObjToUrlParams(config.url as string, config.data);
}
} else {
// 兼容restful风格
config.url = config.url + config.params;
config.params = {};
config.params = undefined;
}
}
return config;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -7993,10 +7993,10 @@ vite-plugin-html@^1.0.0-beta.2:
html-minifier-terser "^5.1.1"
lodash "^4.17.20"

vite-plugin-mock@^1.0.4:
version "1.0.4"
resolved "https://registry.npmjs.org/vite-plugin-mock/-/vite-plugin-mock-1.0.4.tgz#56631559afcd77046b058f162b2b5e8f5aaa7b17"
integrity sha512-jtos6ri0GAE/abv9VQyVvpPF5yQZaFx7vB7GV9wAZ5TQWqzH9nKUdmVj9ret7lC/oCnpaZn+2twxh4qzkVsd5Q==
vite-plugin-mock@^1.0.6:
version "1.0.6"
resolved "https://registry.npmjs.org/vite-plugin-mock/-/vite-plugin-mock-1.0.6.tgz#4f47f193fd48a02c66641fc7242bd5329f99b471"
integrity sha512-+IeCiZBgQt2BpKKzYwoB5bWrrUwiksQh/9zWUrsegGw14PXmXtXXmgHr3CkKjyIChZmvuBs1BPieHD8SyBQAGQ==
dependencies:
"@rollup/plugin-node-resolve" "^9.0.0"
chalk "^4.1.0"
Expand Down

0 comments on commit 34c09fc

Please sign in to comment.