mirror of
https://gitee.com/niucloud-team/niucloud.git
synced 2025-12-12 09:57:20 +00:00
29 lines
727 B
TypeScript
29 lines
727 B
TypeScript
import { defineStore } from 'pinia'
|
|
import { getSiteInfo } from '@/api/system'
|
|
import { redirect } from '@/utils/common'
|
|
|
|
interface System {
|
|
site: AnyObject | null
|
|
}
|
|
|
|
const useSystemStore = defineStore('system', {
|
|
state: () : System => {
|
|
return {
|
|
site: null
|
|
}
|
|
},
|
|
actions: {
|
|
async getSitenfo() {
|
|
await getSiteInfo()
|
|
.then((res: any) => {
|
|
this.site = res.data
|
|
if (this.site.status == 3) redirect({ url: '/pages/index/close', mode: 'reLaunch' })
|
|
})
|
|
.catch((err) => {
|
|
redirect({ url: '/pages/index/nonexistence', mode: 'reLaunch' })
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
export default useSystemStore |