feat: add config endpoint

This commit is contained in:
Methapon Metanipat 2024-10-07 14:32:52 +07:00
parent 48254b06dd
commit fb5e10fe04
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,23 @@
import { defineStore } from 'pinia';
import { api } from 'src/boot/axios';
import { ref } from 'vue';
export const useConfigStore = defineStore('config-store', () => {
const data = ref<AppConfig>();
return {
data,
async getConfig() {
if (data.value) return data.value;
const res = await api.get<AppConfig>('/config');
if (res.status < 400) {
data.value = res.data;
}
return data.value;
},
};
});

View file

@ -0,0 +1,3 @@
type AppConfig = {
vat: number;
};