mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 19:10:12 +08:00
feat: use axios, extract api to another file
This commit is contained in:
1 parent
a40e9eb3a9
commit
66cc1036b4
4 files changed
+59
-5
No files matched your search
@@ -1,13 +1,15 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import api from '../utils/api'
|
||||
|
||||
const questData = ref(null)
|
||||
const questErr = ref(null)
|
||||
|
||||
fetch('https://odyssey.wancat.cc/api/v1/quests/helloworld')
|
||||
.then((res) => res.json())
|
||||
.then((json) => {
|
||||
questData.value = JSON.stringify(json.content)
|
||||
api
|
||||
.get('/quests/helloworld')
|
||||
.then((res) => {
|
||||
console.log(res.data)
|
||||
questData.value = JSON.stringify(res.data.content)
|
||||
})
|
||||
.catch((err) => {
|
||||
questErr.value = err
|
||||
|
||||
Reference in new issue
Block a user