fix: xsrf header is added
All checks were successful
Build (frontend build only) / build (push) Successful in 2m35s
All checks were successful
Build (frontend build only) / build (push) Successful in 2m35s
This commit is contained in:
parent
56337237ed
commit
95dee88bc6
1 changed files with 5 additions and 0 deletions
|
|
@ -1,8 +1,12 @@
|
||||||
import React, { useEffect, useState, useRef } from "react";
|
import React, { useEffect, useState, useRef } from "react";
|
||||||
import { updateUser, getUsersId, postMediaUpload } from "../../api";
|
import { updateUser, getUsersId, postMediaUpload } from "../../api";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { useCookies } from 'react-cookie';
|
||||||
|
|
||||||
export const SettingsPage: React.FC = () => {
|
export const SettingsPage: React.FC = () => {
|
||||||
|
const [cookies] = useCookies(['xsrf_token']);
|
||||||
|
const xsrfToken = cookies['xsrf_token'] || null;
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
|
|
@ -89,6 +93,7 @@ export const SettingsPage: React.FC = () => {
|
||||||
user_desc: userDesc || undefined,
|
user_desc: userDesc || undefined,
|
||||||
avatar_id: avatarId, // Может быть числом или null для удаления
|
avatar_id: avatarId, // Может быть числом или null для удаления
|
||||||
},
|
},
|
||||||
|
headers: { "X-XSRF-TOKEN": xsrfToken },
|
||||||
});
|
});
|
||||||
|
|
||||||
localStorage.setItem("user_name", nickname);
|
localStorage.setItem("user_name", nickname);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue