Skip to content
Snippets Groups Projects
Commit a50e58ba authored by Matthias Feyll's avatar Matthias Feyll
Browse files

ui: fix linting issues

parent a7add3db
Branches
No related tags found
1 merge request!1162Draft: Ui integration
import { fetchSelectedMneThunk } from './routines/mne.routine'
const routines = {
fetchSelectedMneThunk: fetchSelectedMneThunk,
}
import { Alert, Button, Col, Container, Form, Image, Row, Spinner } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import './login.scss'
import logo from '@assets/logo.svg'
import { BasicProp } from '@helper/interfaces'
import React, { useRef } from 'react'
import { Alert, Button, Col, Container, Form, Image, Row, Spinner } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import useLoginViewModel from '../viewmodel/login.viewmodel'
import './login.scss'
const LoginView = ({ children }) => {
const LoginView: React.FC<BasicProp> = () => {
const { t } = useTranslation('common')
const { login, handleErrorMessageRendering, displayFormFieldChecks, loginLoading } = useLoginViewModel();
......
......@@ -55,7 +55,7 @@ const JsonViewerSlice = createSlice({
const { identifier, collapse } = payload
// potentially find already collapsed
let i = state.collapseContainer.findIndex(i => compareIdentifier(identifier, i.identifier))
const i = state.collapseContainer.findIndex(i => compareIdentifier(identifier, i.identifier))
if (i === -1) {
......
......@@ -54,7 +54,7 @@ export const useJsonViewer = ({ json, search, container }: JsonViewerViewModelTy
return !!item.length;
}
const collapse = (key: string, nested: number, json: Object, collapseState: CollapseValues = CollapseValues.TOGGLE) => {
const collapse = (key: string, nested: number, json: object, collapseState: CollapseValues = CollapseValues.TOGGLE) => {
const identifier = { key, nested };
dispatch(toggleCollapse({ identifier, collapse: collapseState }))
......@@ -95,7 +95,7 @@ export const useJsonViewer = ({ json, search, container }: JsonViewerViewModelTy
}
}
const innerSearch = (json: Object, searchValue: string, parentKey: string = "", path: string = "/"): boolean => {
const innerSearch = (json: object, searchValue: string, parentKey: string = "", path: string = "/"): boolean => {
let found = false;
path += parentKey + (parentKey === "" ? "" : "/")
......
......@@ -29,7 +29,7 @@ export const ProtectedLayout = () => {
dispatch(fetchUser());
dispatch(fetchPnds());
}, []);
}, [dispatch]);
/**
* Applies active css class to link if the link is active
......
......@@ -103,7 +103,7 @@ export const AuthProvider: React.FC<BasicProp> = ({ children }) => {
isAuthenticated,
loginProperties
}),
[]
[executeLogin, loginProperties, logout]
);
return (
......
......@@ -23,7 +23,7 @@ interface MenuProviderType {
}
const MenuContext = createContext<MenuProviderType>({
subscribe: function (value: SubscriptionValue): MenuSubscription {
subscribe: function (): MenuSubscription {
throw new Error("Function not implemented.");
}
})
......@@ -86,7 +86,7 @@ export const MenuProvider: React.FC<BasicProp> = ({ children }) => {
hideMenu();
}
});
}, [])
}, [hideMenu])
const value = useMemo<MenuProviderType>(() => {
return {
......
......@@ -8,7 +8,7 @@ interface UtilsProviderType {
}
const UtilsContext = createContext<UtilsProviderType>({
toClipboard: function (text: string): void {
toClipboard: function (): void {
throw new Error("Function not implemented.");
}
})
......@@ -23,7 +23,7 @@ export const UtilsProvider: React.FC<BasicProp> = ({ children }) => {
toast.info(t('global.toast.copied'))
},
} as UtilsProviderType
}, [])
}, [t])
return (
<UtilsContext.Provider value={value}>
......
......@@ -6,7 +6,7 @@ import { setToken } from './user.reducer'
interface ThunkEntityDTO {
thunk: any
payload: any
payload: Object
/**
* Only one subscription per category is allowed. New subscription will unsubscribe and overwrite the old one
......@@ -45,14 +45,14 @@ const RoutineSlice = createSlice({
},
setThunkId: (state, { payload }: PayloadAction<{ id: number; category: CATEGORIES }>) => {
const thunk = state.thunks[CATEGORIES[payload.category]]
const thunk = state.thunks[CATEGORIES[payload.category] as any]
if (!thunk) {
// TODO
throw new Error('Thunk not found')
}
state.thunks[CATEGORIES[payload.category]] = { ...thunk, id: payload.id, locked: false }
state.thunks[CATEGORIES[payload.category] as any] = { ...thunk, id: payload.id, locked: false }
},
removeAll: (state) => {
......@@ -107,8 +107,13 @@ startListening({
predicate: (action) => addRoutine.match(action),
effect: async (action, listenerApi) => {
const { routine } = listenerApi.getOriginalState() as RootState
const lastThunk = routine.thunks[CATEGORIES[action.payload.category]]
const lastThunk = routine.thunks[CATEGORIES[action.payload.category] as any]
if (lastThunk) {
if (!lastThunk.id) {
throw new Error()
// TODO
}
RoutineManager.unsubscribe(lastThunk.id)
}
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment