use pinia to replace vuex, code refactor

This commit is contained in:
MaysWind
2023-06-10 23:13:31 +08:00
parent 0d84f2857f
commit 46d85e92cd
80 changed files with 4972 additions and 4859 deletions
+24
View File
@@ -0,0 +1,24 @@
import { defineStore } from 'pinia';
import currencyConstants from '@/consts/currency.js';
import datetimeConstants from '@/consts/datetime.js';
export const useSettingsStore = defineStore('settings', {
state: () => ({
defaultSetting: {
language: '',
currency: currencyConstants.defaultCurrency,
firstDayOfWeek: datetimeConstants.defaultFirstDayOfWeek,
longDateFormat: 0,
shortDateFormat: 0,
longTimeFormat: 0,
shortTimeFormat: 0
}
}),
actions: {
updateLocalizedDefaultSettings({ defaultCurrency, defaultFirstDayOfWeek }) {
this.defaultSetting.currency = defaultCurrency;
this.defaultSetting.firstDayOfWeek = defaultFirstDayOfWeek;
}
}
});