mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-17 03:31:52 +00:00
add How-to & Signout modal
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.controller('SideNavController', function ($auth, User, $rootScope, $scope) {
|
||||
.controller('SideNavController', function ($auth, User, $rootScope, $scope, Modal) {
|
||||
var vm = this
|
||||
|
||||
vm.isAuthenticated = $auth.isAuthenticated()
|
||||
@@ -16,11 +16,7 @@ angular.module('codexen')
|
||||
reloadUser()
|
||||
|
||||
vm.signOut = function () {
|
||||
$auth.logout()
|
||||
.then(function () {
|
||||
console.log('Sign Out')
|
||||
$rootScope.$broadcast('userSignOut')
|
||||
})
|
||||
Modal.signOut()
|
||||
}
|
||||
|
||||
$scope.$on('userSignIn', function () {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.controller('SignOutModalController', function ($modalInstance) {
|
||||
var vm = this
|
||||
|
||||
vm.submit = function () {
|
||||
$modalInstance.close()
|
||||
}
|
||||
|
||||
vm.cancel = function () {
|
||||
$modalInstance.dismiss('cancel')
|
||||
}
|
||||
})
|
||||
@@ -3,13 +3,19 @@ angular.module('codexen')
|
||||
.controller('AuthSignInController', function ($auth, $rootScope) {
|
||||
var vm = this
|
||||
|
||||
vm.authFailed = false
|
||||
|
||||
vm.signIn = function () {
|
||||
vm.authFailed = false
|
||||
$auth.login({
|
||||
email: vm.email,
|
||||
password: vm.password
|
||||
}).then(function (data) {
|
||||
console.log(data)
|
||||
$rootScope.$broadcast('userSignIn')
|
||||
}, function (err) {
|
||||
console.log(err)
|
||||
vm.authFailed = true
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user