hoangvu96z / Hvtekshop_App

0 stars 0 forks source link

[Enhancement] Prevent user from accessing to detail pages (product, order, ...) if user not login before #16

Closed hoangvu96z closed 2 years ago

hoangvu96z commented 2 years ago

Currently, users can access all pages even though they are not logged in, so need to prevent user from accessing to detail pages (all pages except login and register page).

Acceptance cretirea

Guide :

After logging in successfully, i currentUser key will be save to localStorage, please use it to check login status image Or you can also use currentUserValue function of AuthService to check it. image

Using Angular guard to implement it .

Ref : https://viblo.asia/p/bao-ve-routes-su-dung-guards-trong-angular-3Q75wWX35Wb https://angular.io/api/router/CanActivate https://www.youtube.com/watch?v=tSfvCfVoW2M