SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //1.0
  2. import DashBoard from "./pages/dashboard.svelte";
  3.  
  4. //2.0               2.1
  5. @Controller("/user/:username")
  6. class UserController{
  7.                                  //3.1                   3.2  
  8.   constructor( private userRepo: UserRepo, private auth: AuthService){
  9.  
  10.   }
  11.  
  12.  
  13.   @View("/dashboard",DashBoard)
  14.   //4.1
  15.   async displayDashBoard(@Param('username') username:string,@History() history){
  16.     //4.2       4.3               4.4             4.5  
  17.     let token = await this.auth.getAuthentication(username);
  18.    
  19.     if(!token){
  20.       return history.replace("/forbidden")
  21.     }else{
  22.       //4.6                       should be validated server side as well
  23.       let dashboardStatus = await this.userRepo.getDashBoardStatus(token);
  24.       return {
  25.           username,
  26.           dashboardStatus
  27.       }
  28.     }
  29.    
  30.   }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top