This commit is contained in:
2020-06-24 18:56:24 +03:00
parent 9447ee613b
commit 5d4972145b
119 changed files with 5412 additions and 5086 deletions
Regular → Executable
+3 -1
View File
@@ -1,7 +1,9 @@
enum ActionTypes {
SET_USER = 'SET_USER',
LOGOUT = 'LOGOUT',
ADD_NOTIFICATION = 'ADD_NOTIFICATION'
ADD_NOTIFICATION = 'ADD_NOTIFICATION',
SET_MODAL = 'SET_MODAL',
HIDE_MODAL = 'HIDE_MODAL'
}
export default ActionTypes;
Regular → Executable
+10 -1
View File
@@ -14,5 +14,14 @@ const addNotification = (notification: React.ReactNode) => ({
notification
});
const setModal = (modal: React.ReactNode | null) => ({
type: ActionTypes.SET_MODAL,
modal
});
const hideModal = () => ({
type: ActionTypes.HIDE_MODAL
})
export { setUser, logout,
addNotification };
addNotification,
setModal, hideModal };
View File
Regular → Executable
+2 -2
View File
@@ -1,6 +1,6 @@
import {combineReducers} from "redux";
import currentUser from "./currentUser";
import notifications from "./notifications";
import modal from "./modal";
export default combineReducers({ currentUser, notifications })
export default combineReducers({ currentUser, notifications, modal })
+21
View File
@@ -0,0 +1,21 @@
import React from "react";
import ActionTypes from "../actionTypes";
const initialState: React.ReactNode | null = null;
type Action = {
type: string
modal: React.ReactNode | null
}
export default (state=initialState, action: Action) => {
switch (action.type) {
case ActionTypes.SET_MODAL: {
return action.modal;
}
case ActionTypes.HIDE_MODAL: {
return null;
}
default: return state;
}
}
View File
Regular → Executable
View File