-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from tahmid-saj/dev-ts-redux
migrating reducers to ts
- Loading branch information
Showing
8 changed files
with
134 additions
and
127 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { combineReducers } from "@reduxjs/toolkit"; | ||
// import { combineReducers } from "@reduxjs/toolkit"; | ||
|
||
import { userReducer } from "./shared/user/user.reducer.toolkit"; | ||
import { nutritionTrackerReducer } from "./signed-out/nutrition-tracker/nutrition-tracker.reducer.toolkit"; | ||
// import { userReducer } from "./shared/user/user.reducer.toolkit"; | ||
// import { nutritionTrackerReducer } from "./signed-out/nutrition-tracker/nutrition-tracker.reducer.toolkit"; | ||
|
||
export const rootReducer = combineReducers({ | ||
user: userReducer, | ||
// export const rootReducer = combineReducers({ | ||
// user: userReducer, | ||
|
||
nutritionTracker: nutritionTrackerReducer | ||
}) | ||
// nutritionTracker: nutritionTrackerReducer | ||
// }) |
76 changes: 38 additions & 38 deletions
76
src/store/signed-out/nutrition-tracker/nutrition-tracker.reducer.toolkit.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
import { createSlice } from "@reduxjs/toolkit"; | ||
import { NutritionTrackerState } from "./nutrition-tracker.reducer" | ||
// import { createSlice } from "@reduxjs/toolkit"; | ||
// import { NutritionTrackerState } from "./nutrition-tracker.reducer" | ||
|
||
export const NUTRITION_TRACKER_INITIAL_STATE: NutritionTrackerState = { | ||
nutritionTrackedDays: [], | ||
formInputMicronutrients: [], | ||
filterConditions: null, | ||
nutritionTrackedDaysView: [], | ||
dayTrackedSearchResult: undefined, | ||
nutritionTrackedDaysSummary: {} | ||
} | ||
// export const NUTRITION_TRACKER_INITIAL_STATE: NutritionTrackerState = { | ||
// nutritionTrackedDays: [], | ||
// formInputMicronutrients: [], | ||
// filterConditions: null, | ||
// nutritionTrackedDaysView: [], | ||
// dayTrackedSearchResult: undefined, | ||
// nutritionTrackedDaysSummary: {} | ||
// } | ||
|
||
export const nutritionTrackerSlice = createSlice({ | ||
name: "nutritionTracker", | ||
initialState: NUTRITION_TRACKER_INITIAL_STATE, | ||
reducers: { | ||
setNutritionTrackedDays(state, action) { | ||
state.nutritionTrackedDays = action.payload | ||
}, | ||
setFormInputMicronutrients(state, action) { | ||
state.formInputMicronutrients = action.payload | ||
}, | ||
setFilterConditions(state, action) { | ||
state.filterConditions = action.payload | ||
}, | ||
setNutritionTrackedDaysView(state, action) { | ||
state.nutritionTrackedDaysView = action.payload | ||
}, | ||
setDayTrackedSearchResult(state, action) { | ||
state.dayTrackedSearchResult = action.payload | ||
}, | ||
setNutritionTrackedDaysSummary(state, action) { | ||
state.nutritionTrackedDaysSummary = action.payload | ||
} | ||
} | ||
}) | ||
// export const nutritionTrackerSlice = createSlice({ | ||
// name: "nutritionTracker", | ||
// initialState: NUTRITION_TRACKER_INITIAL_STATE, | ||
// reducers: { | ||
// setNutritionTrackedDays(state, action) { | ||
// state.nutritionTrackedDays = action.payload | ||
// }, | ||
// setFormInputMicronutrients(state, action) { | ||
// state.formInputMicronutrients = action.payload | ||
// }, | ||
// setFilterConditions(state, action) { | ||
// state.filterConditions = action.payload | ||
// }, | ||
// setNutritionTrackedDaysView(state, action) { | ||
// state.nutritionTrackedDaysView = action.payload | ||
// }, | ||
// setDayTrackedSearchResult(state, action) { | ||
// state.dayTrackedSearchResult = action.payload | ||
// }, | ||
// setNutritionTrackedDaysSummary(state, action) { | ||
// state.nutritionTrackedDaysSummary = action.payload | ||
// } | ||
// } | ||
// }) | ||
|
||
export const { setNutritionTrackedDays, setFormInputMicronutrients, setFilterConditions, | ||
setNutritionTrackedDaysView, setDayTrackedSearchResult, setNutritionTrackedDaysSummary | ||
} = nutritionTrackerSlice.actions | ||
// export const { setNutritionTrackedDays, setFormInputMicronutrients, setFilterConditions, | ||
// setNutritionTrackedDaysView, setDayTrackedSearchResult, setNutritionTrackedDaysSummary | ||
// } = nutritionTrackerSlice.actions | ||
|
||
export const nutritionTrackerReducer = nutritionTrackerSlice.reducer | ||
// export const nutritionTrackerReducer = nutritionTrackerSlice.reducer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.