mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
show a confirmation dialog allowing the user to change the editable transaction range to "All" when unable to add or edit a transaction due to the limitation on the editable transaction range
This commit is contained in:
+35
-1
@@ -5,7 +5,10 @@ import { useSettingsStore } from './setting.js';
|
||||
import userState from '@/lib/userstate.js';
|
||||
import services from '@/lib/services.js';
|
||||
import logger from '@/lib/logger.js';
|
||||
import { isNumber } from '@/lib/common.js';
|
||||
import {
|
||||
isObject,
|
||||
isNumber
|
||||
} from '@/lib/common.js';
|
||||
|
||||
export const useUserStore = defineStore('user', {
|
||||
state: () => ({
|
||||
@@ -126,6 +129,37 @@ export const useUserStore = defineStore('user', {
|
||||
});
|
||||
});
|
||||
},
|
||||
updateUserTransactionEditScope({ transactionEditScope }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
services.updateProfile({
|
||||
transactionEditScope: transactionEditScope,
|
||||
}).then(response => {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
reject({ message: 'Unable to update editable transaction range' });
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.result.user && isObject(data.result.user)) {
|
||||
const userStore = useUserStore();
|
||||
userStore.storeUserBasicInfo(data.result.user);
|
||||
}
|
||||
|
||||
resolve(data.result);
|
||||
}).catch(error => {
|
||||
logger.error('failed to save editable transaction range', error);
|
||||
|
||||
if (error.response && error.response.data && error.response.data.errorMessage) {
|
||||
reject({ error: error.response.data });
|
||||
} else if (!error.processed) {
|
||||
reject({ message: 'Unable to update editable transaction range' });
|
||||
} else {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
updateUserAvatar({ avatarFile }) {
|
||||
const self = this;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user