add user settings
This commit is contained in:
+17
-11
@@ -21,31 +21,37 @@ import axios from '@nextcloud/axios'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
export const useConfigStore = defineStore('config', () => {
|
||||
const config = ref(null)
|
||||
const appConfig = ref(null)
|
||||
let config = null
|
||||
let appConfig = null
|
||||
let userConfig = null
|
||||
|
||||
async function getConfig() {
|
||||
if (config.value !== null) {
|
||||
return config.value
|
||||
if (config === null) {
|
||||
config = await axios.get(generateUrl('/apps/side_menu/js/config')).then((response) => response.data)
|
||||
}
|
||||
|
||||
config.value = await axios.get(generateUrl('/apps/side_menu/js/config')).then((response) => response.data)
|
||||
|
||||
return config.value
|
||||
return config
|
||||
}
|
||||
|
||||
async function getAppConfig() {
|
||||
if (appConfig.value !== null) {
|
||||
return appConfig.value
|
||||
if (appConfig === null) {
|
||||
appConfig = await axios.get(generateUrl('/apps/side_menu/admin/config')).then((response) => response.data)
|
||||
}
|
||||
|
||||
appConfig.value = await axios.get(generateUrl('/apps/side_menu/admin/config')).then((response) => response.data)
|
||||
return appConfig
|
||||
}
|
||||
|
||||
return appConfig.value
|
||||
async function getUserConfig() {
|
||||
if (userConfig === null) {
|
||||
userConfig = await axios.get(generateUrl('/apps/side_menu/user/config')).then((response) => response.data)
|
||||
}
|
||||
|
||||
return userConfig
|
||||
}
|
||||
|
||||
return {
|
||||
getConfig,
|
||||
getAppConfig,
|
||||
getUserConfig,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user