Created
November 17, 2019 10:33
-
-
Save webmasterdevlin/601564cc573a9e59cf7c61b213ec4e07 to your computer and use it in GitHub Desktop.
Http Service
This file contains hidden or 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 http from "../shared/http.service"; | |
import { BaseUrl } from "../api.config"; | |
export async function getHeroes() { | |
return await http.get(BaseUrl.heroes); | |
} | |
export async function getHeroById(id) { | |
return await http.get(`${BaseUrl.heroes}${id}`); | |
} | |
export async function postHero(hero) { | |
return await http.post(BaseUrl.heroes, hero); | |
} | |
export async function putHero(hero) { | |
console.log(hero); | |
return await http.put(`${BaseUrl.heroes}${hero._id}`, hero); | |
} | |
export async function deleteHero(id) { | |
return await http.delete(`${BaseUrl.heroes}${id}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment