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