diff --git a/client/src/store/itemSlice.js b/client/src/store/itemSlice.js index ffa456b..8d95add 100644 --- a/client/src/store/itemSlice.js +++ b/client/src/store/itemSlice.js @@ -18,8 +18,10 @@ export const itemSlice = createSlice({ ...state, items: [action.payload, ...state.items], }), - deleteItem: (state, action) => - state.items.filter((i) => i._id !== action.payload), + deleteItem: (state, action) => ({ + ...state, + items: state.items.filter((i) => i._id !== action.payload), + }), setItemsLoading: (state) => ({ ...state, loading: true }), }, }); diff --git a/server.js b/server.js index 069512d..d88744d 100644 --- a/server.js +++ b/server.js @@ -3,7 +3,7 @@ import mongoose from "mongoose"; import path from "path"; import moment from "moment"; import helmet from "helmet"; -// import { MONGO_URI } from "./config/keys.js"; +import { MONGO_URI } from "./config/keys.js"; import items from "./routes/api/items.js"; const app = express(); @@ -11,7 +11,7 @@ const app = express(); // http port const PORT = process.env.PORT || 5000; // database connection key -const db = process.env.MONGO_URI; // || MONGO_URI; +const db = process.env.MONGO_URI || MONGO_URI; // connection to database mongoose