Rewrite actions/modal and reducers/modal with typescript (#24833)
This commit is contained in:
parent
4197b5e4c8
commit
38c6216082
38 changed files with 503 additions and 261 deletions
|
@ -33,7 +33,10 @@ const mapDispatchToProps = dispatch => {
|
|||
},
|
||||
|
||||
onClose() {
|
||||
dispatch(closeModal());
|
||||
dispatch(closeModal({
|
||||
modalType: undefined,
|
||||
ignoreFocus: false,
|
||||
}));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
@ -23,7 +23,10 @@ const mapStateToProps = (state, { statusId }) => ({
|
|||
const mapDispatchToProps = dispatch => ({
|
||||
|
||||
onClose() {
|
||||
dispatch(closeModal());
|
||||
dispatch(closeModal({
|
||||
modalType: undefined,
|
||||
ignoreFocus: false,
|
||||
}));
|
||||
},
|
||||
|
||||
});
|
||||
|
|
|
@ -23,11 +23,14 @@ const mapStateToProps = (state) => ({
|
|||
|
||||
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||
onLogout () {
|
||||
dispatch(openModal('CONFIRM', {
|
||||
message: intl.formatMessage(messages.logoutMessage),
|
||||
confirm: intl.formatMessage(messages.logoutConfirm),
|
||||
closeWhenConfirm: false,
|
||||
onConfirm: () => logOut(),
|
||||
dispatch(openModal({
|
||||
modalType: 'CONFIRM',
|
||||
modalProps: {
|
||||
message: intl.formatMessage(messages.logoutMessage),
|
||||
confirm: intl.formatMessage(messages.logoutConfirm),
|
||||
closeWhenConfirm: false,
|
||||
onConfirm: () => logOut(),
|
||||
},
|
||||
}));
|
||||
},
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ const mapStateToProps = (state) => ({
|
|||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
openClosedRegistrationsModal() {
|
||||
dispatch(openModal('CLOSED_REGISTRATIONS'));
|
||||
dispatch(openModal({ modalType: 'CLOSED_REGISTRATIONS' }));
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -19,11 +19,14 @@ const messages = defineMessages({
|
|||
|
||||
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||
onLogout () {
|
||||
dispatch(openModal('CONFIRM', {
|
||||
message: intl.formatMessage(messages.logoutMessage),
|
||||
confirm: intl.formatMessage(messages.logoutConfirm),
|
||||
closeWhenConfirm: false,
|
||||
onConfirm: () => logOut(),
|
||||
dispatch(openModal({
|
||||
modalType: 'CONFIRM',
|
||||
modalProps: {
|
||||
message: intl.formatMessage(messages.logoutMessage),
|
||||
confirm: intl.formatMessage(messages.logoutConfirm),
|
||||
closeWhenConfirm: false,
|
||||
onConfirm: () => logOut(),
|
||||
},
|
||||
}));
|
||||
},
|
||||
});
|
||||
|
|
|
@ -32,7 +32,7 @@ import MediaModal from './media_modal';
|
|||
import ModalLoading from './modal_loading';
|
||||
import VideoModal from './video_modal';
|
||||
|
||||
const MODAL_COMPONENTS = {
|
||||
export const MODAL_COMPONENTS = {
|
||||
'MEDIA': () => Promise.resolve({ default: MediaModal }),
|
||||
'VIDEO': () => Promise.resolve({ default: VideoModal }),
|
||||
'AUDIO': () => Promise.resolve({ default: AudioModal }),
|
||||
|
|
|
@ -34,7 +34,10 @@ const mapDispatchToProps = dispatch => {
|
|||
},
|
||||
|
||||
onClose() {
|
||||
dispatch(closeModal());
|
||||
dispatch(closeModal({
|
||||
modalType: undefined,
|
||||
ignoreFocus: false,
|
||||
}));
|
||||
},
|
||||
|
||||
onToggleNotifications() {
|
||||
|
|
|
@ -11,7 +11,7 @@ const SignInBanner = () => {
|
|||
const dispatch = useAppDispatch();
|
||||
|
||||
const openClosedRegistrationsModal = useCallback(
|
||||
() => dispatch(openModal('CLOSED_REGISTRATIONS')),
|
||||
() => dispatch(openModal({ modalType: 'CLOSED_REGISTRATIONS' })),
|
||||
[dispatch],
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue