fixed type errors

This commit is contained in:
2025-09-16 14:20:38 +01:00
parent c506c395e6
commit b98e3ed85d
21 changed files with 161 additions and 130 deletions

View File

@@ -8,18 +8,20 @@ export const initalState = {
export function reducer(state: AlertState, action: AlertPayload) {
switch (action.type) {
case "ADD": {
const alreadyExists = state.allAlerts.some(
(alertItem) => alertItem.vrm === action.payload.vrm
);
if (alreadyExists) {
return { ...state };
} else {
if (action.payload && "vrm" in action.payload) {
const alreadyExists = state.allAlerts.some(
(alertItem) => alertItem.vrm === action.payload.vrm
);
if (alreadyExists) {
return state;
}
return {
...state,
alertList: [...state.allAlerts, action.payload],
allAlerts: [...state.allAlerts, action.payload],
alertList: [...state.allAlerts, action.payload],
};
}
return state;
}
case "SEARCH": {