add files
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import {apiUrl} from '@/tools'
|
||||||
|
|
||||||
|
const client = axios.create({
|
||||||
|
baseURL: apiUrl,
|
||||||
|
withCredentials: true
|
||||||
|
})
|
||||||
|
|
||||||
|
export default {
|
||||||
|
async checkSession ({commit}, cb = null) {
|
||||||
|
commit('toggleLoading', true)
|
||||||
|
let flag = false
|
||||||
|
try {
|
||||||
|
await client({
|
||||||
|
method: 'get',
|
||||||
|
url: '/api/session'
|
||||||
|
})
|
||||||
|
flag = true
|
||||||
|
} catch (err) {
|
||||||
|
flag = false
|
||||||
|
}
|
||||||
|
if (typeof cb === 'function') cb(flag)
|
||||||
|
commit('toggleLoading', false)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
toggleLoading (state, loading = null) {
|
||||||
|
state.loading = !!loading
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export const apiUrl = 'https://bot.trj.tw'
|
||||||
Reference in New Issue
Block a user