|
|
@ -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: {
|
|
|
|