Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
PPL KI Ganjil 2021 2022
Clicks - Ecosystem Business
clicks-frontend
Commits
fbce1380
Commit
fbce1380
authored
Oct 28, 2021
by
Abraham Rudolf Brahmana
Browse files
feat: Add reducer to redux ecosystem
parent
7ce31d8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/redux/ecosystem/reducer.tsx
0 → 100644
View file @
fbce1380
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
;
src/redux/store.tsx
View file @
fbce1380
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
],
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment