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.
38 lines
738 B
38 lines
738 B
![]()
2 years ago
|
import { defineStore } from "pinia";
|
||
|
import axios from "axios";
|
||
|
import { ref } from "vue";
|
||
|
|
||
|
export const usePlatformConfig = defineStore("platformConfig", () => {
|
||
|
const isLoading = ref(false);
|
||
|
const settings = ref(null);
|
||
|
|
||
|
function getSetting(variable) {
|
||
|
if (settings.value && settings.value[variable]) {
|
||
|
return settings.value[variable];
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
async function findSettingsRequest() {
|
||
|
isLoading.value = true;
|
||
|
|
||
|
const { data } = await axios.get("/platform-config/list");
|
||
|
|
||
|
settings.value = data.settings;
|
||
|
|
||
|
isLoading.value = false;
|
||
|
}
|
||
|
|
||
|
async function initialize() {
|
||
|
await findSettingsRequest();
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
isLoading,
|
||
|
settings,
|
||
|
initialize,
|
||
|
getSetting,
|
||
|
};
|
||
|
});
|