Redirect to tabs when user is selected
This commit is contained in:
parent
6d6460ac3e
commit
ef86deb222
@ -14,7 +14,7 @@ export class AppComponent {
|
|||||||
this.storageService.getCurrentUserId().then((userId) => {
|
this.storageService.getCurrentUserId().then((userId) => {
|
||||||
if (userId !== undefined && userId !== null) {
|
if (userId !== undefined && userId !== null) {
|
||||||
console.log('userId: ', userId);
|
console.log('userId: ', userId);
|
||||||
this.router.navigate(['/tabs'], userId);
|
this.router.navigate(['/tabs/allowance', userId]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -4,7 +4,7 @@ import { AllowancePage } from './allowance.page';
|
|||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: ':id',
|
||||||
component: AllowancePage,
|
component: AllowancePage,
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin-top: 40%;
|
margin-top: 150px;
|
||||||
color: var(--ion-color-primary);
|
color: var(--ion-color-primary);
|
||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selection {
|
.selection {
|
||||||
gap: 10%;
|
gap: 10%;
|
||||||
margin-top: 20%;
|
margin-top: 100px;
|
||||||
color: var(--ion-color-primary);
|
color: var(--ion-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,4 +27,5 @@
|
|||||||
height: 130px;
|
height: 130px;
|
||||||
border: 1px solid var(--ion-color-primary);
|
border: 1px solid var(--ion-color-primary);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
background-color: var(--ion-color-secondary);
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
import { User } from 'src/app/models/user';
|
import { User } from 'src/app/models/user';
|
||||||
import { StorageService } from 'src/app/services/storage.service';
|
import { StorageService } from 'src/app/services/storage.service';
|
||||||
import { UserService } from 'src/app/services/user.service';
|
import { UserService } from 'src/app/services/user.service';
|
||||||
@ -12,7 +13,11 @@ import { UserService } from 'src/app/services/user.service';
|
|||||||
export class UserLoginPage implements OnInit {
|
export class UserLoginPage implements OnInit {
|
||||||
public users: Array<User> = [];
|
public users: Array<User> = [];
|
||||||
|
|
||||||
constructor(private userService: UserService, private storageService: StorageService) { }
|
constructor(
|
||||||
|
private userService: UserService,
|
||||||
|
private storageService: StorageService,
|
||||||
|
private router: Router
|
||||||
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.userService.getUserList().subscribe(users => {
|
this.userService.getUserList().subscribe(users => {
|
||||||
@ -22,5 +27,6 @@ export class UserLoginPage implements OnInit {
|
|||||||
|
|
||||||
selectUser(id: number) {
|
selectUser(id: number) {
|
||||||
this.storageService.set('user-id', id);
|
this.storageService.set('user-id', id);
|
||||||
|
this.router.navigate(['/tabs/allowance', id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user