Skip to content

Commit

Permalink
fixed alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedibra28 committed Nov 2, 2020
1 parent 6e194b4 commit 5314a25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions client/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ svg {
main {
min-height: 70vh;
}

.alert-msg {
margin-top: 22px;
}
8 changes: 6 additions & 2 deletions client/src/components/layout/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ const Alert = ({ alerts }) =>
alerts !== null &&
alerts.length > 0 &&
alerts.map((alert) => (
<div key={alert.id} className={`mt-2 alert alert-${alert.alertType}`}>
{alert.msg}
<div className='row text-center alert-msg'>
<div className='col-lg-5 col-md-6 col-sm-10 col-12 mx-auto'>
<span key={alert.id} className={`mt-2 alert alert-${alert.alertType}`}>
{alert.msg}
</span>
</div>
</div>
));

Expand Down
10 changes: 5 additions & 5 deletions client/src/reducers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
LOGIN_SUCCESS,
LOGIN_FAIL,
LOGOUT,
} from '../actions/types';
} from "../actions/types";

const initialState = {
token: localStorage.getItem('token'),
token: localStorage.getItem("token"),
isAuthenticated: null,
loading: true,
user: null,
Expand All @@ -28,18 +28,18 @@ export default function (state = initialState, action) {
};
case REGISTER_SUCCESS:
case LOGIN_SUCCESS:
localStorage.setItem('token', payload.token);
localStorage.setItem("token", payload.token);
return {
...state,
...payload,
isAuthenticated: true,
loading: false,
};
case REGISTER_FAIL:

case AUTH_ERROR:
case LOGIN_FAIL:
case LOGOUT:
localStorage.removeItem('token');
localStorage.removeItem("token");
return {
...state,
...payload,
Expand Down

0 comments on commit 5314a25

Please sign in to comment.