small fix
This commit is contained in:
@@ -27,17 +27,21 @@ export const userSlice = createSlice({
|
|||||||
(restaurant) => restaurant.id === action.payload.id
|
(restaurant) => restaurant.id === action.payload.id
|
||||||
);
|
);
|
||||||
let restaurants: Restaurant[] = state.restaurants || [];
|
let restaurants: Restaurant[] = state.restaurants || [];
|
||||||
state = {
|
if (index != undefined) {
|
||||||
...state,
|
state = {
|
||||||
restaurants: [
|
...state,
|
||||||
...restaurants.slice(0, index),
|
restaurants: [
|
||||||
action.payload,
|
...restaurants.slice(0, index),
|
||||||
...restaurants.slice(index + 1),
|
action.payload,
|
||||||
],
|
...restaurants.slice(index + 1),
|
||||||
};
|
],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
state = state;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const { clearUserData } = userSlice.actions;
|
export const { clearUserData, updateRestaurant } = userSlice.actions;
|
||||||
export default userSlice.reducer;
|
export default userSlice.reducer;
|
||||||
|
|||||||
Reference in New Issue
Block a user