Skip to content

Instantly share code, notes, and snippets.

@bangpound
Last active June 16, 2016 05:23
Show Gist options
  • Save bangpound/78ce69e2ada8eaec6429231f25733594 to your computer and use it in GitHub Desktop.
Save bangpound/78ce69e2ada8eaec6429231f25733594 to your computer and use it in GitHub Desktop.
diff --git a/src/app/controllers/login.controller.js b/src/app/controllers/login.controller.js
index df3eba1..a0d15b3 100644
--- a/src/app/controllers/login.controller.js
+++ b/src/app/controllers/login.controller.js
@@ -30,11 +30,12 @@ export class LoginController {
let userId = this.$Auth.getPayload().userId;
this.User.get({ id: userId }, (user) => {
this.$UserService.setUser(user);
-
+ return user;
+ }).$promise.then((user) => {
// On user's first login, go to the profile
if (!user.profile_confirmed) {
this.$state.go('app.stressometer');
- this.$ProfileService.openModal(false);
+ return this.$ProfileService.openModal(false);
} else {
this.$state.go('app.dashboard.overview');
}
diff --git a/src/app/controllers/profile.controller.js b/src/app/controllers/profile.controller.js
index 2810925..f1b7575 100644
--- a/src/app/controllers/profile.controller.js
+++ b/src/app/controllers/profile.controller.js
@@ -33,11 +33,12 @@ export class ProfileController {
}
this.profile.$edit(
- () => {
+ (response) => {
this.alerts = [];
this.fixDates();
this.user.profile_confirmed = true;
- this.uibModalInstance.close();
+ this.uibModalInstance.close(response);
+ return response;
},
(response) => {
this.$log.log("Profile was not saved.");
diff --git a/src/app/services/profile/profile.service.js b/src/app/services/profile/profile.service.js
index 743fd61..fb51d35 100644
--- a/src/app/services/profile/profile.service.js
+++ b/src/app/services/profile/profile.service.js
@@ -8,7 +8,7 @@ export class ProfileService {
}
openModal(profileConfirmed) {
- this.$uibModal.open({
+ return this.$uibModal.open({
templateUrl: 'app/views/profile.html',
controller: 'ProfileController',
controllerAs: 'profile',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment