Leon Gaban
Leon Gaban

Reputation: 39018

Module parse failed error Unexpected token } - Webpack

I'm not sure why I'm getting this error

ERROR in ./login/loginController.js
Module parse failed: /Users/leon/Projects/admin/login/loginController.js Line 66: Unexpected token }
You may need an appropriate loader to handle this file type.
|             console.log('login failed!');
|         }
|     }
| }
|
 @ ./entry.js 16:22-59

This is my entry.js file

Here is the loginController (line 66 is the last closing } in the code below:

var loginController = angular
    .module('loginController', [])
    .controller('LoginCtrl', LoginCtrl);

LoginCtrl.$inject = [
    '$rootScope',
    '$scope',
    '$location',
    '$timeout',
    'ApiFactory',
    'AUTH_EVENTS',
    'AuthFactory'];

function LoginCtrl(
    $rootScope,
    $scope,
    $location,
    $timeout,
    ApiFactory,
    AUTH_EVENTS,
    AuthFactory) {

    /** Init LoginCtrl scope */
    /** --------------------------------------------------------------------- */
    var vs = $scope;
        vs.login = login;

    $rootScope.$broadcast(AUTH_EVENTS.loginSuccess);

    $rootScope.$on(AUTH_EVENTS.notAuthenticated, function (event, data) {
        $rootScope.currentUser = null;
        $scope.currentUser     = null;
        AuthFactory.logout();
        $location.path('/login');
    });

    function login(credentials) {
        console.log('credentials',credentials);
        AuthFactory.login(credentials).then(function (user) {
            $rootScope.$broadcast(AUTH_EVENTS.loginSuccess);
            $scope.setCurrentUser(user);

            if (user.password_reset) {
                $location.path('/password');
            } else {
                $location.path('/tickers');
            }
        }, function () {
            // $scope.loginData.message = "Invalid Username/Password";
            $rootScope.$broadcast(AUTH_EVENTS.loginFailed);
            console.log('login failed!');
        }
    }
}

module.exports = loginController;

Upvotes: 2

Views: 2442

Answers (1)

Gilgamesh
Gilgamesh

Reputation: 668

I think your issue is AuthFactory.login(credentials).then(function (user) {, it doesn't look like there's a ) closing off this method call.

Upvotes: 4

Related Questions