Added auth headers to api requests

This commit is contained in:
Paweł Malak
2021-11-12 12:38:01 +01:00
parent 0d36c5cf94
commit d94a6cea5a
12 changed files with 135 additions and 56 deletions

View File

@@ -29,7 +29,10 @@ interface Props {
}
export const Apps = (props: Props): JSX.Element => {
const { apps, loading } = useSelector((state: State) => state.apps);
const {
apps: { apps, loading },
auth: { isAuthenticated },
} = useSelector((state: State) => state);
const dispatch = useDispatch();
const { getApps } = bindActionCreators(actionCreators, dispatch);
@@ -76,10 +79,12 @@ export const Apps = (props: Props): JSX.Element => {
subtitle={<Link to="/">Go back</Link>}
/>
<div className={classes.ActionsContainer}>
<ActionButton name="Add" icon="mdiPlusBox" handler={toggleModal} />
<ActionButton name="Edit" icon="mdiPencil" handler={toggleEdit} />
</div>
{isAuthenticated && (
<div className={classes.ActionsContainer}>
<ActionButton name="Add" icon="mdiPlusBox" handler={toggleModal} />
<ActionButton name="Edit" icon="mdiPencil" handler={toggleEdit} />
</div>
)}
<div className={classes.Apps}>
{loading ? (