Bug fix and format code
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
f94e9e7634
commit
a86a40e845
@ -1,7 +1,7 @@
|
||||
export interface Work {
|
||||
id_work: number,
|
||||
link: string,
|
||||
user_id: number,
|
||||
language_id: number,
|
||||
content: string
|
||||
id_work: number;
|
||||
link: string;
|
||||
user_id: number;
|
||||
language_id: number;
|
||||
content: string;
|
||||
}
|
@ -1,32 +1,35 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Work} from "../models/work.model";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {Observable} from "rxjs";
|
||||
import {NgForm} from "@angular/forms";
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Work } from '../models/work.model';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { NgForm } from '@angular/forms';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class WorksService {
|
||||
API_URL = 'http://127.0.0.1:3000'
|
||||
API_URL = 'http://127.0.0.1:3000';
|
||||
|
||||
private works: Work[] = [];
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getWorks(): Observable<any> {
|
||||
return this.http.get(`${this.API_URL}/works`);
|
||||
}
|
||||
|
||||
postWork(form: NgForm): void {
|
||||
let body = {link: form.value.link, id_user: 1, id_language: 1, code: form.value.content}
|
||||
let body = {
|
||||
link: form.value.link,
|
||||
id_user: 1,
|
||||
id_language: 1,
|
||||
code: form.value.content,
|
||||
};
|
||||
this.http.post<any>(`${this.API_URL}/works`, body).subscribe();
|
||||
}
|
||||
|
||||
postWorkCode(code: string): void {
|
||||
let body = {link: 'TODO', id_user: 1, id_language: 1, code: code}
|
||||
let body = { link: 'TODO', id_user: 1, id_language: 1, code: code };
|
||||
this.http.post<any>(`${this.API_URL}/works`, body).subscribe();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue