change dashboard -> recipe
This commit is contained in:
parent
e95078307b
commit
36be0426f6
9 changed files with 71 additions and 40 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { NgModule, inject } from '@angular/core';
|
||||
import {
|
||||
ActivatedRoute,
|
||||
ActivatedRouteSnapshot,
|
||||
CanActivateFn,
|
||||
Router,
|
||||
|
|
@ -9,7 +8,7 @@ import {
|
|||
Routes,
|
||||
} from '@angular/router';
|
||||
import { UserService } from './core/services/user.service';
|
||||
import { lastValueFrom, map } from 'rxjs';
|
||||
import { map } from 'rxjs';
|
||||
|
||||
const authGuard: CanActivateFn = (
|
||||
route: ActivatedRouteSnapshot,
|
||||
|
|
@ -47,7 +46,7 @@ const loginGuard: CanActivateFn = (
|
|||
// redirect to redirectUrl query param
|
||||
console.log(route.queryParams['redirectUrl']);
|
||||
return router.createUrlTree([
|
||||
router.parseUrl(route.queryParams['redirectUrl'] ?? '/dashboard'),
|
||||
router.parseUrl(route.queryParams['redirectUrl'] ?? '/recipes'),
|
||||
]);
|
||||
// return false;
|
||||
})
|
||||
|
|
@ -76,12 +75,12 @@ const routes: Routes = [
|
|||
{
|
||||
path: '',
|
||||
pathMatch: 'full',
|
||||
redirectTo: 'dashboard',
|
||||
redirectTo: 'recipes',
|
||||
},
|
||||
{
|
||||
path: 'dashboard',
|
||||
path: 'recipes',
|
||||
loadComponent: () =>
|
||||
import('./features/dashboard/dashboard.component').then(
|
||||
import('./features/recipes/recipes.component').then(
|
||||
(m) => m.DashboardComponent
|
||||
),
|
||||
canActivate: [authGuard],
|
||||
|
|
@ -90,7 +89,7 @@ const routes: Routes = [
|
|||
path: 'recipe/:productCode',
|
||||
loadComponent: () =>
|
||||
import(
|
||||
'./features/dashboard/recipe-details/recipe-details.component'
|
||||
'./features/recipes/recipe-details/recipe-details.component'
|
||||
).then((m) => m.RecipeDetailsComponent),
|
||||
canActivate: [authGuard],
|
||||
},
|
||||
|
|
@ -103,7 +102,7 @@ const routes: Routes = [
|
|||
},
|
||||
{
|
||||
path: '**',
|
||||
redirectTo: 'dashboard',
|
||||
redirectTo: 'recipes',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue