mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
refactor: rewrite map page using user profile store
This commit is contained in:
1 parent
8a31a58c56
commit
78b9529699
1 file changed
+3
-12
@@ -14,7 +14,9 @@ import {
|
||||
import { DAG } from '@linux-odyssey/utils'
|
||||
import api from '../utils/api'
|
||||
import { NodeImage } from '../img/svg.js'
|
||||
import useUserProfile from '../store/userProfile'
|
||||
|
||||
const store = useUserProfile()
|
||||
const marginX = 500
|
||||
const marginY = 300
|
||||
const chartContainer = ref(null)
|
||||
@@ -40,16 +42,6 @@ async function getQuests() {
|
||||
}
|
||||
}
|
||||
|
||||
async function getProgress() {
|
||||
try {
|
||||
const res = await api.get('/users/me')
|
||||
return res.data.progress
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
const genOption = (nodes: any, edges: any) => ({
|
||||
renderer: 'svg',
|
||||
tooltip: {},
|
||||
@@ -163,8 +155,7 @@ function initChart(option: any) {
|
||||
|
||||
onMounted(async () => {
|
||||
const quests = await getQuests()
|
||||
const progress = await getProgress()
|
||||
const option = getOption(quests, progress)
|
||||
const option = getOption(quests, store.progress)
|
||||
initChart(option)
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user