Skip to content

Commit

Permalink
added auth only profile img update
Browse files Browse the repository at this point in the history
  • Loading branch information
anirbanmajumder0 committed May 25, 2024
1 parent 275b5fe commit 79f9b97
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Components/shared/ProfilePhoto.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export function ProfilePhoto({ userDetails, setUserData }) {

const [loading , setLoading] = useState(false);

const csrftoken = localStorage.getItem('csrftoken');

const dataURLtoFile = (dataUrl, filename) => {
const arr = dataUrl.split(",");
const mime = arr[0].match(/:(.*?);/)[1];
Expand Down Expand Up @@ -62,10 +64,10 @@ export function ProfilePhoto({ userDetails, setUserData }) {
const response = await fetch(`${url}/profile/`, {
method: "POST",
headers: {
"Authorization": `Token ${csrftoken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
email: userDetails.email,
profile_image: imageUrl,
}),
});
Expand Down

0 comments on commit 79f9b97

Please sign in to comment.