Skip to content

Commit f3db765

Browse files
committed
✨ ajout du module subscription
1 parent 8a93865 commit f3db765

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/app/core/guards/admin.guard.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { CanActivate } from '@angular/router';
2+
import { CanActivateChild } from '@angular/router';
33
import { Store } from '@ngrx/store';
44
import { first, map, Observable } from 'rxjs';
55

@@ -10,7 +10,7 @@ import { User } from '@app/modules/user/interfaces/user.interface';
1010
@Injectable({
1111
providedIn: 'root'
1212
})
13-
export class AdminGuard implements CanActivate {
13+
export class AdminGuard implements CanActivateChild {
1414

1515
constructor(private store: Store) {}
1616

@@ -20,7 +20,7 @@ export class AdminGuard implements CanActivate {
2020
2121
];
2222

23-
canActivate(): Observable<boolean> {
23+
canActivateChild(): Observable<boolean> {
2424
return this.store.select(selectCurrentUser).pipe(
2525
first(),
2626
map((user: User | null) => {

src/app/core/routes/app.routing.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@ export const routes: Routes = [
1313
loadChildren: () =>
1414
import('@modules/dashboard/dashboard.module')
1515
.then(m => m.DashboardModule)
16+
},
17+
{
18+
path: 'plans',
19+
loadChildren: () =>
20+
import('@modules/subscription/subscription.module')
21+
.then(m => m.SubscriptionModule)
1622
}
1723
];

src/app/core/store/app.store.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import { Action, ActionReducerMap } from '@ngrx/store';
33

44
import { AuthState } from '@app/modules/authentication/interfaces/state.interface';
55
import { authFeatureKey, authReducer } from '@app/modules/authentication/store/auth.reducer';
6+
import { subscriptionFeatureKey, subscriptionReducer } from '@app/modules/subscription/store/subscription.reducer';
7+
import { SubscriptionState } from '@app/modules/subscription/interfaces/state.interface';
68

79
export interface AppState {
810
router: RouterState;
911
[authFeatureKey]: AuthState;
12+
[subscriptionFeatureKey]: SubscriptionState;
1013
}
1114

1215
export const ROOT_REDUCERS: ActionReducerMap<AppState, Action> = {
1316
router: routerReducer,
1417
[authFeatureKey]: authReducer,
18+
[subscriptionFeatureKey]: subscriptionReducer,
1519
};

0 commit comments

Comments
 (0)