aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts9
-rw-r--r--src/DevHive.Angular/src/app/components/profile/profile.component.ts9
2 files changed, 14 insertions, 4 deletions
diff --git a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts
index d7c7ee6..0848f51 100644
--- a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts
+++ b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts
@@ -1,3 +1,4 @@
+import {Location} from '@angular/common';
import {HttpErrorResponse} from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
@@ -18,7 +19,7 @@ export class ProfileSettingsComponent implements OnInit {
public user: User;
public successfulUpdate = false;
- constructor(private _router: Router, private _userService: UserService, private _fb: FormBuilder)
+ constructor(private _router: Router, private _userService: UserService, private _fb: FormBuilder, private _location: Location)
{ }
ngOnInit(): void {
@@ -107,7 +108,11 @@ export class ProfileSettingsComponent implements OnInit {
}
goBack(): void {
- this._router.navigate(['/']);
+ const currURL = this._location.path();
+ this._location.back();
+ if (this._location.path() === currURL) {
+ this.goToProfile();
+ }
}
logout(): void {
diff --git a/src/DevHive.Angular/src/app/components/profile/profile.component.ts b/src/DevHive.Angular/src/app/components/profile/profile.component.ts
index bfa3e3d..b4c42a0 100644
--- a/src/DevHive.Angular/src/app/components/profile/profile.component.ts
+++ b/src/DevHive.Angular/src/app/components/profile/profile.component.ts
@@ -4,6 +4,7 @@ import { UserService } from 'src/app/services/user.service';
import { User } from 'src/models/identity/user';
import { AppConstants } from 'src/app/app-constants.module';
import {HttpErrorResponse} from '@angular/common/http';
+import {Location} from '@angular/common';
@Component({
selector: 'app-profile',
@@ -16,7 +17,7 @@ export class ProfileComponent implements OnInit {
public dataArrived = false;
public user: User;
- constructor(private _router: Router, private _userService: UserService)
+ constructor(private _router: Router, private _userService: UserService, private _location: Location)
{ }
private setDefaultUser(): void {
@@ -65,7 +66,11 @@ export class ProfileComponent implements OnInit {
}
goBack(): void {
- this._router.navigate(['/']);
+ const currURL = this._location.path();
+ this._location.back();
+ if (this._location.path() === currURL) {
+ this._router.navigate(['/']);
+ }
}
navigateToSettings(): void {