SHARE
TWEET

Untitled

a guest Jun 25th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export class User {
  2.     user_id: string;
  3. }
  4.      
  5. const user = new User();
  6.   user.user_id = (Este digito lo obtiene correctmanete de un JWT decodificado por ejemplo id: 10)
  7.  
  8.   this._ns.getUserNovelData(jwt, user).subscribe((data: any) => {
  9.     this.usuario_novela = data.novelas;
  10.     console.log(this.usuario_novela);
  11.   });
  12.      
  13. getUserNovelData(jwt: string, user: User): Observable<any> {
  14.  
  15.     const httpOptions = {
  16.       headers: new HttpHeaders({
  17.         'Content-Type':  'application/x-www-form-urlencoded',
  18.         'Authorization': jwt
  19.       })
  20.     };
  21.  
  22.     const url = `${ this.urlnovelsdb }/api/novelas-usuario`;
  23.     return this.http.post(url, user, httpOptions);
  24.   }
  25.      
  26. function getUserNovel(req, res) {
  27.     var id = req.body;
  28.     console.log(id);  // devuelve [Object: null prototype] { '{"user_id":10}': '' }
  29.     novelas.sequelize.query('Aqui va una mega ultra Select').then(novelas => {
  30.         res.status(200).send({ novelas })
  31.     }).catch(err => {
  32.         res.status(500).send({ message: 'Ocurrio un erro al buscar la novela' })
  33.     });
  34. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top