Cockatrice/webclient/src/store/server/server.dispatch.ts
Joseph Chamish 73c5956ece
Dev/jchamish/forgotpassword (#4481)
* Implementation of Forgotten Password Reset

* Update webclient/src/hooks/useReduxEffect.tsx

Co-authored-by: Zach H <zahalpern+github@gmail.com>
2021-11-19 21:00:05 -05:00

68 lines
1.8 KiB
TypeScript

import { reset } from 'redux-form';
import { Actions } from './server.actions';
import { store } from 'store';
export const Dispatch = {
clearStore: () => {
store.dispatch(Actions.clearStore());
},
connectionClosed: reason => {
store.dispatch(Actions.connectionClosed(reason));
},
updateBuddyList: buddyList => {
store.dispatch(Actions.updateBuddyList(buddyList));
},
addToBuddyList: user => {
store.dispatch(reset('addToBuddies'));
store.dispatch(Actions.addToBuddyList(user));
},
removeFromBuddyList: userName => {
store.dispatch(Actions.removeFromBuddyList(userName));
},
updateIgnoreList: ignoreList => {
store.dispatch(Actions.updateIgnoreList(ignoreList));
},
addToIgnoreList: user => {
store.dispatch(reset('addToIgnore'));
store.dispatch(Actions.addToIgnoreList(user));
},
removeFromIgnoreList: userName => {
store.dispatch(Actions.removeFromIgnoreList(userName));
},
updateInfo: (name, version) => {
store.dispatch(Actions.updateInfo({
name,
version
}));
},
updateStatus: (state, description) => {
store.dispatch(Actions.updateStatus({
state,
description
}));
},
updateUser: user => {
store.dispatch(Actions.updateUser(user));
},
updateUsers: users => {
store.dispatch(Actions.updateUsers(users));
},
userJoined: user => {
store.dispatch(Actions.userJoined(user));
},
userLeft: name => {
store.dispatch(Actions.userLeft(name));
},
viewLogs: name => {
store.dispatch(Actions.viewLogs(name));
},
clearLogs: () => {
store.dispatch(Actions.clearLogs());
},
serverMessage: message => {
store.dispatch(Actions.serverMessage(message));
},
resetPassword: () => {
store.dispatch(Actions.resetPassword());
}
}