diff --git a/app/src/api.ts b/app/src/api.ts index 884f7f0f2d..b4d6c24ead 100644 --- a/app/src/api.ts +++ b/app/src/api.ts @@ -41,7 +41,7 @@ export const onResponse = (response: AxiosResponse | Response) => { }; export const onError = async (error: RequestError) => { - const notify = useNotificationsStore(); + const notificationsStore = useNotificationsStore(); const requestsStore = useRequestsStore(); const id = (error.response.config as RequestConfig).id; requestsStore.endRequest(id); @@ -82,7 +82,7 @@ export const onError = async (error: RequestError) => { } } - notify.add({ + notificationsStore.add({ title: i18n.t(`errors.${code}`), text: message, type: 'error', diff --git a/app/src/composables/use-item/use-item.ts b/app/src/composables/use-item/use-item.ts index c210ed7bc7..b1afdb67cf 100644 --- a/app/src/composables/use-item/use-item.ts +++ b/app/src/composables/use-item/use-item.ts @@ -20,7 +20,7 @@ export function useItem(collection: Ref, primaryKey: Ref primaryKey.value === '+'); const isBatch = computed(() => typeof primaryKey.value === 'string' && primaryKey.value.includes(',')); const isSingle = computed(() => !!collectionInfo.value?.meta?.singleton); - const notify = useNotificationsStore(); + const notificationsStore = useNotificationsStore(); const isArchived = computed(() => { if (!collectionInfo.value?.meta?.archive_field) return null; @@ -92,14 +92,14 @@ export function useItem(collection: Ref, primaryKey: Ref, primaryKey: Ref, primaryKey: Ref, primaryKey: Ref)[] | null>, diff --git a/app/src/modules/files/routes/collection.vue b/app/src/modules/files/routes/collection.vue index e190305e3d..382c25befa 100644 --- a/app/src/modules/files/routes/collection.vue +++ b/app/src/modules/files/routes/collection.vue @@ -183,7 +183,7 @@ export default defineComponent({ }, }, setup(props) { - const notify = useNotificationsStore(); + const notificationsStore = useNotificationsStore(); const { folders } = useFolders(); const layoutRef = ref(null); const selection = ref([]); @@ -419,7 +419,7 @@ export default defineComponent({ function enableDropEffect() { showDropEffect.value = true; - dragNotificationID = notify.add({ + dragNotificationID = notificationsStore.add({ title: i18n.t('drop_to_upload'), icon: 'cloud_upload', type: 'info', @@ -432,7 +432,7 @@ export default defineComponent({ showDropEffect.value = false; if (dragNotificationID) { - notify.remove(dragNotificationID); + notificationsStore.remove(dragNotificationID); } } @@ -489,12 +489,12 @@ export default defineComponent({ dragCounter.value = 0; if (dragNotificationID) { - notify.remove(dragNotificationID); + notificationsStore.remove(dragNotificationID); } const files = [...event.dataTransfer.files]; - fileUploadNotificationID = notify.add({ + fileUploadNotificationID = notificationsStore.add({ title: i18n.tc('upload_file_indeterminate', files.length, { done: 0, total: files.length, @@ -517,7 +517,7 @@ export default defineComponent({ const total = files.length; const done = progress.filter((p) => p === 100).length; - notify.update(fileUploadNotificationID, { + notificationsStore.update(fileUploadNotificationID, { title: i18n.tc('upload_file_indeterminate', files.length, { done, total, @@ -528,7 +528,7 @@ export default defineComponent({ }, }); - notify.remove(fileUploadNotificationID); + notificationsStore.remove(fileUploadNotificationID); emitter.emit(Events.upload); } } diff --git a/app/src/modules/settings/routes/data-model/field-detail/field-detail.vue b/app/src/modules/settings/routes/data-model/field-detail/field-detail.vue index b497303b9c..7ca2f2d185 100644 --- a/app/src/modules/settings/routes/data-model/field-detail/field-detail.vue +++ b/app/src/modules/settings/routes/data-model/field-detail/field-detail.vue @@ -153,7 +153,7 @@ export default defineComponent({ }, }, setup(props) { - const notify = useNotificationsStore(); + const notificationsStore = useNotificationsStore(); const collectionsStore = useCollectionsStore(); const fieldsStore = useFieldsStore(); const relationsStore = useRelationsStore(); @@ -360,12 +360,12 @@ export default defineComponent({ await relationsStore.hydrate(); if (props.field !== '+') { - notify.add({ + notificationsStore.add({ title: i18n.t('field_update_success', { field: props.field }), type: 'success', }); } else { - notify.add({ + notificationsStore.add({ title: i18n.t('field_create_success', { field: fieldData.field }), type: 'success', }); diff --git a/app/src/modules/settings/routes/data-model/fields/components/field-select.vue b/app/src/modules/settings/routes/data-model/fields/components/field-select.vue index 5dc9413a1a..1fd6c30de6 100644 --- a/app/src/modules/settings/routes/data-model/fields/components/field-select.vue +++ b/app/src/modules/settings/routes/data-model/fields/components/field-select.vue @@ -217,7 +217,7 @@ export default defineComponent({ }, }, setup(props) { - const notify = useNotificationsStore(); + const notificationsStore = useNotificationsStore(); const relationsStore = useRelationsStore(); const collectionsStore = useCollectionsStore(); const fieldsStore = useFieldsStore(); @@ -346,7 +346,7 @@ export default defineComponent({ try { await fieldsStore.createField(duplicateTo.value, newField); - notify.add({ + notificationsStore.add({ title: i18n.t('field_create_success', { field: newField.name }), type: 'success', }); diff --git a/app/src/modules/settings/routes/data-model/new-collection.vue b/app/src/modules/settings/routes/data-model/new-collection.vue index 3c6b8e658e..3805b1bf9f 100644 --- a/app/src/modules/settings/routes/data-model/new-collection.vue +++ b/app/src/modules/settings/routes/data-model/new-collection.vue @@ -127,7 +127,7 @@ import i18n from '@/lang'; export default defineComponent({ setup() { - const notify = useNotificationsStore(); + const notificationsStore = useNotificationsStore(); const collectionsStore = useCollectionsStore(); const fieldsStore = useFieldsStore(); @@ -215,7 +215,7 @@ export default defineComponent({ await collectionsStore.hydrate(); await fieldsStore.hydrate(); - notify.add({ + notificationsStore.add({ title: 'Collection Created', type: 'success', }); diff --git a/app/src/stores/collections.ts b/app/src/stores/collections.ts index b3bf936db9..24225ac011 100644 --- a/app/src/stores/collections.ts +++ b/app/src/stores/collections.ts @@ -56,12 +56,12 @@ export const useCollectionsStore = createStore({ this.reset(); }, async updateCollection(collection: string, updates: Partial) { - 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'), }); diff --git a/app/src/stores/settings.ts b/app/src/stores/settings.ts index 46f1d7a0b6..8c937ef03e 100644 --- a/app/src/stores/settings.ts +++ b/app/src/stores/settings.ts @@ -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', }); diff --git a/app/src/utils/upload-file/upload-file.ts b/app/src/utils/upload-file/upload-file.ts index e3fccd8af6..7eeb772a8e 100644 --- a/app/src/utils/upload-file/upload-file.ts +++ b/app/src/utils/upload-file/upload-file.ts @@ -13,7 +13,7 @@ export default async function uploadFile( fileId?: string; } ) { - const notify = useNotificationsStore(); + const notificationsStore = useNotificationsStore(); const progressHandler = options?.onProgressChange || (() => undefined); const formData = new FormData(); @@ -39,7 +39,7 @@ export default async function uploadFile( } if (options?.notifications) { - notify.add({ + notificationsStore.add({ title: i18n.t('upload_file_success'), type: 'success', }); diff --git a/app/src/utils/upload-files/upload-files.ts b/app/src/utils/upload-files/upload-files.ts index 9935f966fe..215d34a1ec 100644 --- a/app/src/utils/upload-files/upload-files.ts +++ b/app/src/utils/upload-files/upload-files.ts @@ -10,7 +10,7 @@ export default async function uploadFiles( preset?: Record; } ) { - const notify = useNotificationsStore(); + const notificationsStore = useNotificationsStore(); const progressHandler = options?.onProgressChange || (() => undefined); const progressForFiles = files.map(() => 0); @@ -28,7 +28,7 @@ export default async function uploadFiles( ); if (options?.notifications) { - notify.add({ + notificationsStore.add({ title: i18n.t('upload_files_success', { count: files.length }), type: 'success', }); diff --git a/app/src/views/private/components/comments-sidebar-detail/comment-input.vue b/app/src/views/private/components/comments-sidebar-detail/comment-input.vue index 88f4b6b62c..2719280880 100644 --- a/app/src/views/private/components/comments-sidebar-detail/comment-input.vue +++ b/app/src/views/private/components/comments-sidebar-detail/comment-input.vue @@ -45,7 +45,7 @@ export default defineComponent({ }, }, setup(props) { - const notify = useNotificationsStore(); + const notificationsStore = useNotificationsStore(); const textarea = ref(); useShortcut('meta+enter', postComment, textarea); const newCommentContent = ref(null); @@ -68,7 +68,7 @@ export default defineComponent({ newCommentContent.value = null; - notify.add({ + notificationsStore.add({ title: i18n.t('post_comment_success'), type: 'success', });