Skip to content

Commit ac0b94d

Browse files
committed
Correção dsa rotas de edição e adição.
1 parent 1e171b2 commit ac0b94d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/app/routes/users/users-add/users-add.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export class UsersAddComponent {
4242
private toastService: ToastService) {
4343

4444
this.visible.subscribe((visible: Boolean) => {
45+
let root = this.router.url.split('?')[0].split('/')[1];
46+
4547
if (visible) {
4648
this.form = this.formBuilder.group({
4749
Name: this.formBuilder.control({
@@ -76,10 +78,10 @@ export class UsersAddComponent {
7678

7779
this.renderer.addClass(document.body, 'overflow');
7880
this.renderer.setProperty(this.panel.nativeElement, 'scrollTop', '0');
79-
this.location.go(this.router.url.split('?')[0] + '/new');
81+
this.location.go(root + '/new');
8082
} else {
8183
this.renderer.removeClass(document.body, 'overflow');
82-
this.location.go(this.router.url.split('?')[0]);
84+
this.location.go(root);
8385
}
8486
});
8587
}

src/app/routes/users/users-edit/users-edit.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export class UsersEditComponent {
4242
@Inject(LOCALE_ID) private locale: string) {
4343

4444
this.visible.subscribe((visible: Boolean) => {
45+
let root = this.router.url.split('?')[0].split('/')[1];
46+
4547
if (visible) {
4648
this.form = this.formBuilder.group({
4749
Name: this.formBuilder.control({
@@ -76,12 +78,10 @@ export class UsersEditComponent {
7678

7779
this.renderer.addClass(document.body, 'overflow');
7880
this.renderer.setProperty(this.panel.nativeElement, 'scrollTop', '0');
79-
console.log(route);
80-
console.log(router);
81-
this.location.go(this.router.url.split('?')[0] + '/' + this.user.Id);
81+
this.location.go(root + '/' + this.user.Id);
8282
} else {
8383
this.renderer.removeClass(document.body, 'overflow');
84-
this.location.go(this.router.url.split('?')[0]);
84+
this.location.go(root);
8585
}
8686
});
8787
}

0 commit comments

Comments
 (0)