Internal: use setup configuration for pinia' platformConfig store

pull/4853/head
Angel Fernando Quiroz Campos 1 year ago
parent edb45c5127
commit a564821c7e
  1. 2
      assets/vue/components/StudentViewButton.vue
  2. 2
      assets/vue/store/cidReq.js
  3. 20
      assets/vue/store/platformConfig.js

@ -41,7 +41,7 @@ const isStudentView = computed({
}
},
get() {
return platformConfigStore.isStudentViewActive()
return platformConfigStore.isStudentViewActive
},
})

@ -12,7 +12,7 @@ export const useCidReqStore = defineStore("cidReq", {
const platformConfigStore = usePlatformConfig()
return (userId, cId = 0, checkStudentView = true) => {
if (checkStudentView && platformConfigStore.isStudentViewActive()) {
if (checkStudentView && platformConfigStore.isStudentViewActive) {
return false
}

@ -1,21 +1,13 @@
import { defineStore } from "pinia";
import axios from "axios";
import { ref } from "vue";
import { computed, ref } from "vue"
export const usePlatformConfig = defineStore("platformConfig", () => {
const isLoading = ref(false);
const settings = ref(null);
const settings = ref([]);
const studentView = ref('teacherview');
const plugins = ref([])
function getSetting(variable) {
if (settings.value && settings.value[variable]) {
return settings.value[variable];
}
return null;
}
async function findSettingsRequest() {
isLoading.value = true;
@ -38,9 +30,11 @@ export const usePlatformConfig = defineStore("platformConfig", () => {
await findSettingsRequest();
}
function isStudentViewActive() {
return 'studentview' === studentView.value
}
const getSetting = computed(
() => (variable) => (settings.value && settings.value[variable] ? settings.value[variable] : null),
)
const isStudentViewActive = computed(() => "studentview" === studentView.value)
return {
isLoading,

Loading…
Cancel
Save