Improve consistency

This commit is contained in:
rijkvanzanten
2020-10-26 10:33:11 +01:00
parent c8653589b1
commit 4e54d9fe1e
12 changed files with 35 additions and 34 deletions

View File

@@ -56,12 +56,12 @@ export const useCollectionsStore = createStore({
this.reset();
},
async updateCollection(collection: string, updates: Partial<Collection>) {
const notify = useNotificationsStore();
const notificationsStore = useNotificationsStore();
try {
await api.patch(`/collections/${collection}`, updates);
await this.hydrate();
notify.add({
notificationsStore.add({
type: 'success',
title: i18n.t('update_collection_success'),
});
@@ -70,11 +70,11 @@ export const useCollectionsStore = createStore({
}
},
async deleteCollection(collection: string) {
const notify = useNotificationsStore();
const notificationsStore = useNotificationsStore();
try {
await api.delete(`/collections/${collection}`);
await this.hydrate();
notify.add({
notificationsStore.add({
type: 'success',
title: i18n.t('delete_collection_success'),
});

View File

@@ -24,7 +24,7 @@ export const useSettingsStore = createStore({
},
async updateSettings(updates: { [key: string]: any }) {
const notify = useNotificationsStore();
const notificationsStore = useNotificationsStore();
const settingsCopy = { ...this.state.settings };
const newSettings = merge({}, this.state.settings, updates);
@@ -35,7 +35,7 @@ export const useSettingsStore = createStore({
this.state.settings = response.data.data;
notify.add({
notificationsStore.add({
title: i18n.t('settings_update_success'),
type: 'success',
});