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

@@ -51,6 +51,7 @@ export const AuthForm = (): JSX.Element => {
id="password"
name="password"
placeholder="••••••"
autoComplete="current-password"
value={formData.password}
onChange={(e) =>
setFormData({ ...formData, password: e.target.value })

View File

@@ -9,8 +9,9 @@ import { actionCreators } from '../../../store';
// Typescript
import { ApiResponse } from '../../../interfaces';
// UI
// Other
import { InputGroup, Button } from '../../UI';
import { applyAuth } from '../../../utility';
export const StyleSettings = (): JSX.Element => {
const dispatch = useDispatch();
@@ -34,7 +35,11 @@ export const StyleSettings = (): JSX.Element => {
e.preventDefault();
axios
.put<ApiResponse<{}>>('/api/config/0/css', { styles: customStyles })
.put<ApiResponse<{}>>(
'/api/config/0/css',
{ styles: customStyles },
{ headers: applyAuth() }
)
.then(() => {
createNotification({
title: 'Success',