From 03f6600033e441bd9d5f945c63372700ad6027f0 Mon Sep 17 00:00:00 2001 From: Tim Eder <tim.eder@ufz.de> Date: Tue, 3 May 2022 14:05:06 +0200 Subject: [PATCH] fixed vuex console warnings --- store/configurations.ts | 6 +++--- store/contacts.ts | 6 +++--- store/devices.ts | 4 ++-- store/files.ts | 2 +- store/platforms.ts | 4 ++-- store/vocabulary.ts | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/store/configurations.ts b/store/configurations.ts index e17a72dc1..39d5a073a 100644 --- a/store/configurations.ts +++ b/store/configurations.ts @@ -78,7 +78,7 @@ export interface configurationsState { pageSize: number } -const state = { +const state = () => ({ configurations: [], configuration: null, configurationContacts: [], @@ -87,7 +87,7 @@ const state = { totalPages: 1, pageNumber: 1, pageSize: 20 -} +}) const getters = { projectNames: (state: configurationsState) => { @@ -170,7 +170,7 @@ const getters = { return result }, locationActionsDates: (state: configurationsState) => { - let result = [] + let result: IActionDateWithTextItem[] = [] if (state.configuration) { const datesWithTexts = [] diff --git a/store/contacts.ts b/store/contacts.ts index c7bd1e1b8..697771653 100644 --- a/store/contacts.ts +++ b/store/contacts.ts @@ -39,21 +39,21 @@ import { Api } from '@/services/Api' interface contactsState { contacts: Contact[], - contact: Contact|null, + contact: Contact | null, configurationContacts: Contact[], pageNumber: number, pageSize: number, totalPages: number } -export const state = { +export const state = () => ({ contacts: [], contact: null, configurationContacts: [], totalPages: 1, pageNumber: 1, pageSize: 20 -} +}) export const getters = { searchContacts: (state: contactsState) => { return state.contacts.filter((c: Contact) => !state.configurationContacts.find((rc: Contact) => rc.id === c.id)) diff --git a/store/devices.ts b/store/devices.ts index c007e3dc5..c453ca8f5 100644 --- a/store/devices.ts +++ b/store/devices.ts @@ -87,7 +87,7 @@ interface devicesState { totalPages: number } -const state = { +const state = () => ({ devices: [], device: null, deviceContacts: [], @@ -109,7 +109,7 @@ const state = { pageNumber: 1, pageSize: 20, totalPages: 1 -} +}) const getters = { actions: (state: devicesState) => { // Todo actions sortieren, wobei ehrlich gesagt, eine extra route im Backend mit allen Actions (sortiert) besser wäre diff --git a/store/files.ts b/store/files.ts index ebbbde8cd..02e759d71 100644 --- a/store/files.ts +++ b/store/files.ts @@ -33,7 +33,7 @@ import { Commit } from 'vuex' import { IUploadResult } from '@/services/sms/UploadApi' import { Api } from '@/services/Api' -const state = {} +const state = () => ({}) const getters = {} diff --git a/store/platforms.ts b/store/platforms.ts index 245666394..1f1b065b9 100644 --- a/store/platforms.ts +++ b/store/platforms.ts @@ -72,7 +72,7 @@ interface platformsState { totalPages: number } -const state = { +const state = () => ({ platforms: [], platform: null, platformContacts: [], @@ -88,7 +88,7 @@ const state = { totalPages: 1, pageNumber: 1, pageSize: 20 -} +}) const getters = { actions: (state: platformsState) => { diff --git a/store/vocabulary.ts b/store/vocabulary.ts index 376fba84b..dfe6db843 100644 --- a/store/vocabulary.ts +++ b/store/vocabulary.ts @@ -63,7 +63,7 @@ interface vocabularyState { measuredQuantityUnits: MeasuredQuantityUnit[] } -const state = { +const state = () => ({ manufacturers: [], equipmentstatus: [], devicetypes: [], @@ -75,7 +75,7 @@ const state = { properties: [], units: [], measuredQuantityUnits: [] -} +}) const getters = { getPlatformTypeByUri: (state: vocabularyState) => (uri: string): PlatformType | undefined => { -- GitLab