-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.ts
46 lines (40 loc) · 1.12 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import {createApp, ref} from 'vue'
import './style.css'
import App from './App.vue'
import router from './router'
import LoadingStatus from "./utils/enums/LoadingStatus.ts";
import axios from 'axios';
export const BASE_URL = "https://sync.mcsl.com.cn/api/";
export let mainLoadingStatus = ref(LoadingStatus.LOADING);
export let statistics: Statistics;
interface Statistics {
"name": string,
"author": string,
"version": string,
"config": {
"url": string,
"port": number,
"ssl_cert_path": string,
"ssl_key_path": string,
"node_list": {
"endpoint": string,
"name": string,
"type": string,
"alist_subpath": string,
}[],
}
}
const app = createApp(App);
app.use(router);
app.mount('#app');
axios.get(BASE_URL + 'public/statistics').then(res => {
statistics = res.data.data;
mainLoadingStatus.value = LoadingStatus.SUCCESS;
}).catch(e => {
console.error(e);
if (e.response) {
mainLoadingStatus.value = LoadingStatus.FAIL_CODE;
} else {
mainLoadingStatus.value = LoadingStatus.FAIL_CONNECT;
}
});