mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
small fix
This commit is contained in:
@@ -8,10 +8,11 @@ import Spinner from '../common/Spinner';
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
deleteAvatarEndpoint: string;
|
deleteAvatarEndpoint: string;
|
||||||
|
userProfileUrl: string;
|
||||||
authenticityToken: string;
|
authenticityToken: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DeleteAvatarButton = ({ deleteAvatarEndpoint, authenticityToken }: Props) => {
|
const DeleteAvatarButton = ({ deleteAvatarEndpoint, userProfileUrl, authenticityToken }: Props) => {
|
||||||
const [isDeleting, setIsDeleting] = React.useState(false);
|
const [isDeleting, setIsDeleting] = React.useState(false);
|
||||||
const [error, setError] = React.useState('');
|
const [error, setError] = React.useState('');
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ const DeleteAvatarButton = ({ deleteAvatarEndpoint, authenticityToken }: Props)
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
location.reload();
|
window.location.href = userProfileUrl;
|
||||||
} else {
|
} else {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
'UserProfile/DeleteAvatarButton',
|
'UserProfile/DeleteAvatarButton',
|
||||||
{
|
{
|
||||||
deleteAvatarEndpoint: delete_avatar_path,
|
deleteAvatarEndpoint: delete_avatar_path,
|
||||||
|
userProfileUrl: edit_user_registration_path,
|
||||||
authenticityToken: form_authenticity_token
|
authenticityToken: form_authenticity_token
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user