link in api parameter

question-12
Bastien JACQUELIN 2 years ago
parent 1e6b265bd8
commit c25a135d98

@ -1,7 +1,7 @@
class ApiService{ class ApiService{
constructor(){} constructor(){}
async get(id){ async get(link){
const baseUrl = `https://jsonplaceholder.typicode.com/posts/${id}`;//edit const baseUrl = `${link}`;//edit
const headers = { const headers = {
method: 'GET' method: 'GET'
}; };
@ -10,8 +10,8 @@ class ApiService{
console.log(responseJson) console.log(responseJson)
} }
async post(){ async post(link){
const baseUrl = `https://jsonplaceholder.typicode.com/posts/`;//edit const baseUrl = `${link}`;//edit
const headers = { const headers = {
method: 'POST', method: 'POST',
headers: { headers: {

Loading…
Cancel
Save