21 lines
603 B
TypeScript
21 lines
603 B
TypeScript
import { API_BASE_URL } from '~/CONSTANT'
|
|
|
|
const saberPaths = ref<string[]>([])
|
|
const currentSaberDays = ref<string>('')
|
|
|
|
async function refreshPath() {
|
|
if (saberPaths.value.length)
|
|
return
|
|
const resp = await fetch(`${API_BASE_URL}/saber/metadata`)
|
|
const data = await resp.json()
|
|
saberPaths.value = data
|
|
}
|
|
|
|
async function refreshCurrentSaberDays(path: string) {
|
|
const resp = await fetch(`${API_BASE_URL}/saber/metadata/list_days?path=${path}`)
|
|
const data = await resp.json()
|
|
currentSaberDays.value = data
|
|
}
|
|
|
|
export { currentSaberDays, refreshCurrentSaberDays, refreshPath, saberPaths }
|