From 0456ea45eb563dcd4a20baff30be22c56cbd9cfc Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 6 Apr 2019 16:47:23 -0600 Subject: [PATCH] Update Settings Home view, allow user to delete existing profile photo --- resources/views/settings/home.blade.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/resources/views/settings/home.blade.php b/resources/views/settings/home.blade.php index c81d70c9f..f0da05989 100644 --- a/resources/views/settings/home.blade.php +++ b/resources/views/settings/home.blade.php @@ -12,7 +12,9 @@

{{Auth::user()->username}}

-

+

+ +

@csrf @@ -27,6 +29,9 @@
+

+ Delete Profile Photo +

@@ -144,5 +149,17 @@ reader.readAsDataURL(file); } }); + + $('.delete-profile-photo').on('click', function(e) { + e.preventDefault(); + if(window.confirm('Are you sure you want to delete your profile photo.') == false) { + return; + } + axios.delete('/settings/avatar').then(res => { + window.location.href = window.location.href; + }).catch(err => { + swal('Error', 'An error occured, please try again later', 'error'); + }); + }); @endpush