Skip to content

Commit b3b3065

Browse files
author
juzhiyuan
committed
feat: 增加 API Key
1 parent 354a995 commit b3b3065

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const API_KEY = 'edd1c9f034335f136f87ad84b625c8f1'

src/utils/request.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@
2424

2525
import axios from 'axios'
2626
import { Message } from 'element-ui'
27+
import { API_KEY } from '@/config'
2728

2829
const service = axios.create({
2930
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
30-
timeout: 5000
31+
timeout: 5000,
32+
headers: {
33+
'X-API-KEY': API_KEY
34+
}
3135
})
3236

3337
service.interceptors.request.use(

0 commit comments

Comments
 (0)