mirror of
https://github.com/moparisthebest/mail
synced 2024-11-16 06:05:07 -05:00
31 lines
802 B
JavaScript
31 lines
802 B
JavaScript
define(function(require) {
|
|
'use strict';
|
|
|
|
var appController = require('js/app-controller'),
|
|
errorUtil = require('js/util/error');
|
|
|
|
var AddAccountCtrl = function($scope, $location) {
|
|
// global state... inherited to all child scopes
|
|
$scope.$root.state = {};
|
|
// attach global error handler
|
|
errorUtil.attachHandler($scope);
|
|
|
|
$scope.connectToGoogle = function() {
|
|
appController._auth.getCredentials({}, function(err) {
|
|
if (err) {
|
|
$scope.onError(err);
|
|
return;
|
|
}
|
|
|
|
redirect();
|
|
});
|
|
};
|
|
|
|
function redirect() {
|
|
$location.path('/login');
|
|
$scope.$apply();
|
|
}
|
|
};
|
|
|
|
return AddAccountCtrl;
|
|
}); |