Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Component} from '@angular/core';
- import {HttpClient, HttpHeaders} from '@angular/common/http';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent {
- title = 'tickerence';
- constructor(private http: HttpClient) {
- }
- registerUser() {
- const config = {headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')};
- const user: User = ({
- name: 'Pawel',
- surname: 'Tester',
- email: 'tester@wp.pl',
- password: 'loremipsum12',
- password_confirm: 'loremipsum12',
- event_id: 1,
- });
- this.http.post('https://dev.api.tickerence.com/api/1.3/user/register-b2b', user, config).subscribe((res) => {
- console.log(res);
- console.log(user);
- },
- error => {
- console.log(error);
- console.log(user);
- });
- }
- }
- interface User {
- name: string;
- surname: string;
- email: string;
- password: string;
- password_confirm: string;
- event_id: number;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement