Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/assets/vue/store/platformConfig.js

52 lines
1.2 KiB

import { defineStore } from "pinia"
import axios from "axios"
import { computed, ref } from "vue"
export const usePlatformConfig = defineStore("platformConfig", () => {
const isLoading = ref(false)
const settings = ref([])
const studentView = ref("teacherview")
const plugins = ref([])
const visualTheme = ref("chamilo")
async function findSettingsRequest() {
isLoading.value = true
try {
const { data } = await axios.get("/platform-config/list")
visualTheme.value = data.visual_theme
settings.value = data.settings
studentView.value = data.studentview
plugins.value = data.plugins
} catch (e) {
console.log(e)
} finally {
isLoading.value = false
}
}
async function initialize() {
await findSettingsRequest()
}
const getSetting = computed(
() => (variable) => (settings.value && settings.value[variable] ? settings.value[variable] : null),
)
const isStudentViewActive = computed(() => "studentview" === studentView.value)
return {
isLoading,
settings,
studentView,
plugins,
initialize,
getSetting,
isStudentViewActive,
visualTheme,
}
})