This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new b3b3065 feat: 增加 API Key
b3b3065 is described below
commit b3b306550e8e5153d42d943d2d652914e2ad88e3
Author: juzhiyuan <[email protected]>
AuthorDate: Thu Mar 5 15:16:59 2020 +0800
feat: 增加 API Key
---
src/config.ts | 1 +
src/utils/request.ts | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/config.ts b/src/config.ts
new file mode 100644
index 0000000..b0c5240
--- /dev/null
+++ b/src/config.ts
@@ -0,0 +1 @@
+export const API_KEY = 'edd1c9f034335f136f87ad84b625c8f1'
diff --git a/src/utils/request.ts b/src/utils/request.ts
index 3e59d38..2fb28d3 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -24,10 +24,14 @@
import axios from 'axios'
import { Message } from 'element-ui'
+import { API_KEY } from '@/config'
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
- timeout: 5000
+ timeout: 5000,
+ headers: {
+ 'X-API-KEY': API_KEY
+ }
})
service.interceptors.request.use(