Created
November 10, 2019 22:45
-
-
Save parzibyte/9dbb07fdc1bb9ff1bdedae8494b4eeef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from "@angular/core"; | |
import { HttpClient } from "@angular/common/http"; | |
import { Persona } from "./persona"; | |
@Injectable({ | |
providedIn: "root" | |
}) | |
export class PersonasService { | |
rutaApi = "https://rest-api-angular-php--parzibyte.repl.co"; | |
constructor(private http: HttpClient) {} | |
obtener() { | |
return this.http.get(`${this.rutaApi}/obtenerPersonas.php`); | |
} | |
registrar(persona: Persona) { | |
return this.http.post(`${this.rutaApi}/registrarPersona.php`, persona); | |
} | |
actualizar(persona: Persona) { | |
return this.http.put(`${this.rutaApi}/actualizarPersona.php`, persona); | |
} | |
eliminar(id: string | number) { | |
return this.http.delete(`${this.rutaApi}/eliminarPersona.php?id=${id}`); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment