fixed type errors
This commit is contained in:
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user