From ea580327dbcee44dc9b3ce114c8d0fabf4f54a24 Mon Sep 17 00:00:00 2001 From: John Wu <524306184@qq.com> Date: Wed, 6 May 2020 12:18:35 +0800 Subject: [PATCH] fix: curl command guide --- src/components/SubmitFlag.vue | 17 +++++++++++------ src/utils.js | 3 +++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/SubmitFlag.vue b/src/components/SubmitFlag.vue index 901110c..e3739d6 100644 --- a/src/components/SubmitFlag.vue +++ b/src/components/SubmitFlag.vue @@ -4,14 +4,18 @@

POST /flag


Content-Type: application/json

-

Header:

Authorization: {{info.Token}}

+

Header: +

Authorization: {{info.Token}}
+

Body:

- {"flag": "your_flag_here"} + {"flag": + "your_flag_here"}


- curl -X POST {{utils.baseURL}}/flag -H 'Authorization: {{info.Token}}' -d '{ "flag": "your_flag_here" }' + curl + -X POST {{baseURL}}/api/flag -H 'Authorization: {{info.Token}}' -d '{ "flag": "your_flag_here" }'

@@ -22,15 +26,16 @@ name: "SubmitFlag", data: () => ({ - info: null + info: null, + baseURL: window.location.origin, }), mounted() { this.getInfo() }, - methods:{ - getInfo(){ + methods: { + getInfo() { this.utils.GET("/team/info").then(res => { this.info = res }) diff --git a/src/utils.js b/src/utils.js index 755226b..d3a0e03 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,6 +1,9 @@ import axios from 'axios' let baseURL = '/api' +if (process.env.NODE_ENV === 'development') { + baseURL = 'http://localhost:19999/api' +} export default { baseURL: baseURL,