Parse.User.logout() not working

I’ve got log in working but when I try to logOut the Parse user it doesn’t work (taking out Parse.User.logout() allows the alert to pop up). Console says 1 999696 error Error: undefined is not a function (evaluating ‘Parse.User.logout()’). Suggestions? Im new to coding

controller

> .controller('ProfileCtrl', function ($scope, $state){
>      $scope.logoutUser = function(){
>             Parse.User.logout();
>             alert("success!");
>             $state.go('login');
>     };
> });

tab.profile.html

<ion-view view-title="Profile">
  <ion-content padding="true" class="has-header">
      <button class="button button-stable button-block" ng-click="logoutUser()">Log Out</button>
  </ion-content>
</ion-view>

Not checked! But if i remember correctly it’s “logOut” not “logout”

2 Likes

try this :

Parse.User.logOut().then(
 function() {
     alert('success');
   }, function(error) {
     alert('error : ' + error);
   }
);
1 Like

Oh wow, this worked haha thank you so much!