Skip to content

Commit d0702fe

Browse files
committed
account-delete-modal: wipe local data
1 parent 27ba57b commit d0702fe

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

app/components/account-delete-modal.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import {localStorageAvailable} from '../utils/local-storage';
2+
13
export default function(app) {
24
app.component('accountDeleteModal', {
35
bindings: {
@@ -11,8 +13,14 @@ export default function(app) {
1113
public submitting = false;
1214
public succeeded = false;
1315

14-
static $inject = ['$http', '$scope', 'authService', 'peopleApi'];
15-
constructor(public $http, public $scope, public authService, public peopleApi) {}
16+
static $inject = [
17+
'$http', '$location', '$scope', '$window',
18+
'authService', 'notificationService', 'peopleApi',
19+
];
20+
constructor(
21+
public $http, public $location, public $scope, public $window,
22+
public authService, public notificationService, public peopleApi,
23+
) {}
1624

1725
public hasError(field) {
1826
const form = this.$scope.accountDeleteForm;
@@ -26,6 +34,13 @@ export default function(app) {
2634
this.peopleApi.deleteAccount(this.authService.user.id)
2735
.then(() => {
2836
this.succeeded = true;
37+
this.authService.logout();
38+
if (localStorageAvailable) this.$window.localStorage.clear();
39+
this.notificationService.notifications.push({
40+
type: 'info',
41+
message: 'Your account has been successfully deleted.',
42+
});
43+
this.$location.url('/');
2944
return this.close();
3045
})
3146
.catch(error => this.error = error)

0 commit comments

Comments
 (0)