gpt4 book ai didi

javascript - 模块解析失败错误意外 token } - Webpack

转载 作者:行者123 更新时间:2023-11-29 18:01:01 27 4
gpt4 key购买 nike

我不确定为什么会收到此错误

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

这是我的 entry.js 文件

这是 loginController(第 66 行是下面代码中的最后一个关闭 }:

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;

最佳答案

我认为您的问题是 AuthFactory.login(credentials).then(function (user) {,它看起来不像是 ) 关闭此方法打电话。

关于javascript - 模块解析失败错误意外 token } - Webpack,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34999384/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com