SHARE
TWEET

Untitled

a guest Aug 18th, 2018 225 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {Component} from '@angular/core';
  2. import {HttpClient, HttpHeaders} from '@angular/common/http';
  3.  
  4. @Component({
  5.     selector: 'app-root',
  6.     templateUrl: './app.component.html',
  7.     styleUrls: ['./app.component.css']
  8. })
  9.  
  10. export class AppComponent {
  11.     title = 'tickerence';
  12.  
  13.     constructor(private http: HttpClient) {
  14.     }
  15.  
  16.     registerUser() {
  17.         const config = {headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')};
  18.         const user: User = ({
  19.             name: 'Pawel',
  20.             surname: 'Tester',
  21.             email: 'tester@wp.pl',
  22.             password: 'loremipsum12',
  23.             password_confirm: 'loremipsum12',
  24.             event_id: 1,
  25.         });
  26.  
  27.         this.http.post('https://dev.api.tickerence.com/api/1.3/user/register-b2b', user, config).subscribe((res) => {
  28.                 console.log(res);
  29.                 console.log(user);
  30.             },
  31.             error => {
  32.                 console.log(error);
  33.                 console.log(user);
  34.             });
  35.     }
  36. }
  37.  
  38. interface User {
  39.     name: string;
  40.     surname: string;
  41.     email: string;
  42.     password: string;
  43.     password_confirm: string;
  44.     event_id: number;
  45. }
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