Last active
April 2, 2021 20:14
-
-
Save tshallenberger/762adfa222b194c5b9b4fcc19f4ea8bf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import { createRoutine } from "redux-saga-routines"; | |
import { Reducer } from "redux"; | |
import { takeLatest, all } from "redux-saga/effects"; | |
import * as _ from "lodash"; | |
import { createSelector } from "reselect"; | |
import { denormalize } from "normalizr"; | |
const MODULE_NAME: string = "Duck"; | |
export interface IDuckState { | |
initialized: boolean; | |
} | |
export const initialDuckState: IDuckState = { | |
initialized: false, | |
}; | |
export class DuckActionTypes { | |
static readonly RESET: string = `@@${MODULE_NAME}/RESET`; | |
static readonly INIT: string = `@@${MODULE_NAME}/INIT`; | |
} | |
export class DuckReset { | |
readonly type = DuckActionTypes.RESET; | |
constructor() {} | |
} | |
export class DuckInit { | |
readonly type = DuckActionTypes.INIT; | |
constructor() {} | |
} | |
// Routine classes | |
export type DuckAction = DuckReset; | |
export const DuckStateReducer: Reducer<IDuckState, DuckAction> = ( | |
state = initialDuckState, | |
action: DuckAction | |
) => { | |
switch (action.type) { | |
case DuckActionTypes.INIT: { | |
return { | |
initialized: true, | |
}; | |
} | |
case DuckActionTypes.RESET: { | |
return _.cloneDeep(initialDuckState); | |
} | |
default: | |
return state; | |
} | |
}; | |
// Selectors | |
export abstract class DuckSelectors {} | |
// Sagas | |
function* loadDuckSaga() {} | |
export function* rootDuckSaga() { | |
yield all([ | |
// takeLatest(DuckLoadRoutine.TRIGGER, loadDuckSaga) | |
]); | |
} | |
// export * from './customRenders'; | |
// export * from './state'; | |
// export * from './actionTypes'; | |
// export * from './routines'; | |
// export * from './actions'; | |
// export * from './reducer'; | |
// export * from './selectors'; | |
// export * from './sagas'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment