Fakultas Ilmu Komputer UI

Commit fbce1380 authored by Abraham Rudolf Brahmana's avatar Abraham Rudolf Brahmana
Browse files

feat: Add reducer to redux ecosystem

parent 7ce31d8a
import { AnyAction } from "redux";
import { ICategory } from "../../types/firestore";
const initialState: ICategory[] = [];
const ecosystemReducer = (
state = initialState,
action: AnyAction
): ICategory[] => {
switch (action.type) {
case "CATEGORIES": {
const payload = action.payload as { categories: ICategory[] };
return { ...state, cateories: payload.categories } as ICategory[];
}
default:
return state;
}
};
export default ecosystemReducer;
import { configureStore } from "@reduxjs/toolkit";
import userReducer from "./user/reducer";
import ecosystemReducer from "./ecosystem/reducer";
import thunk from "redux-thunk";
// const rootReducer = combineReducers({
......@@ -12,6 +13,7 @@ import thunk from "redux-thunk";
const store = configureStore({
reducer: {
user: userReducer,
ecosystem: ecosystemReducer,
},
middleware: [thunk],
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment