add user settings

This commit is contained in:
Simon Vieille
2025-04-13 20:32:13 +02:00
parent 6c4f9120ff
commit fdd8f8850d
20 changed files with 839 additions and 316 deletions
+17 -11
View File
@@ -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,
}
})