forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.ts
More file actions
46 lines (40 loc) · 1.01 KB
/
Copy pathapp.ts
File metadata and controls
46 lines (40 loc) · 1.01 KB
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 { defineStore } from 'pinia'
export interface AppData {
url: string
name: string
env: string
appDownloadUrl: string
documentationUrl: string
githubUrl: string
}
export const useAppStore = defineStore('app', () => {
const config = useRuntimeConfig()
const polling = ref(false)
const appData = computed<AppData>(() => {
const publicConfig = config.public as Record<string, string>
let url = publicConfig.appUrl || ''
if (url.endsWith('/')) {
url = url.substring(0, url.length - 1)
}
return {
url,
env: publicConfig.appEnv,
appDownloadUrl: publicConfig.appDownloadUrl,
documentationUrl: publicConfig.appDocumentationUrl,
githubUrl: publicConfig.appGithubUrl,
name: publicConfig.appName,
}
})
const isLocal = computed(
() => (config.public as Record<string, string>).appEnv === 'local',
)
function setPolling(value: boolean) {
polling.value = value
}
return {
polling,
appData,
isLocal,
setPolling,
}
})