mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Dev/jchamish/forgotpassword (#4481)
* Implementation of Forgotten Password Reset * Update webclient/src/hooks/useReduxEffect.tsx Co-authored-by: Zach H <zahalpern+github@gmail.com>
This commit is contained in:
parent
7c27e955d5
commit
73c5956ece
25 changed files with 447 additions and 7 deletions
43
webclient/src/store/actions/actionReducer.ts
Normal file
43
webclient/src/store/actions/actionReducer.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* @author Luke Brandon Farrell
|
||||
* @description Application reducer.
|
||||
*/
|
||||
|
||||
import { AnyAction } from 'redux'
|
||||
|
||||
interface InitialState {
|
||||
type: string | null
|
||||
payload: any
|
||||
meta: any
|
||||
error: boolean
|
||||
count: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial data.
|
||||
*/
|
||||
const initialState: InitialState = {
|
||||
type: null,
|
||||
payload: null,
|
||||
meta: null,
|
||||
error: false,
|
||||
count: 0,
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the application state.
|
||||
*
|
||||
* @param state
|
||||
* @param action
|
||||
* @return {*}
|
||||
*/
|
||||
export const actionReducer = (
|
||||
state = initialState,
|
||||
action: AnyAction,
|
||||
): InitialState => {
|
||||
return {
|
||||
...state,
|
||||
...action,
|
||||
count: state.count + 1,
|
||||
}
|
||||
}
|
||||
1
webclient/src/store/actions/index.ts
Normal file
1
webclient/src/store/actions/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { actionReducer } from './actionReducer';
|
||||
|
|
@ -6,6 +6,7 @@ export { SortUtil } from './common';
|
|||
// Server
|
||||
|
||||
export {
|
||||
Types as ServerTypes,
|
||||
Selectors as ServerSelectors,
|
||||
Dispatch as ServerDispatch } from './server';
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@ import { combineReducers } from 'redux';
|
|||
import { roomsReducer } from './rooms';
|
||||
import { serverReducer } from './server';
|
||||
import { reducer as formReducer } from 'redux-form'
|
||||
import { actionReducer } from './actions'
|
||||
|
||||
export default combineReducers({
|
||||
rooms: roomsReducer,
|
||||
server: serverReducer,
|
||||
|
||||
form: formReducer
|
||||
form: formReducer,
|
||||
action: actionReducer
|
||||
});
|
||||
|
|
|
|||
|
|
@ -66,5 +66,8 @@ export const Actions = {
|
|||
}),
|
||||
clearLogs: () => ({
|
||||
type: Types.CLEAR_LOGS
|
||||
}),
|
||||
resetPassword: () => ({
|
||||
type: Types.RESET_PASSWORD
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,5 +61,8 @@ export const Dispatch = {
|
|||
},
|
||||
serverMessage: message => {
|
||||
store.dispatch(Actions.serverMessage(message));
|
||||
},
|
||||
resetPassword: () => {
|
||||
store.dispatch(Actions.resetPassword());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,5 +15,6 @@ export const Types = {
|
|||
USER_JOINED: '[Server] User Joined',
|
||||
USER_LEFT: '[Server] User Left',
|
||||
VIEW_LOGS: '[Server] View Logs',
|
||||
CLEAR_LOGS: '[Server] Clear Logs'
|
||||
CLEAR_LOGS: '[Server] Clear Logs',
|
||||
RESET_PASSWORD: '[Server] Reset Password'
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue