Last active
March 18, 2019 10:13
-
-
Save achepukov/d093bc06ab1b9c3984e4673d976d076f to your computer and use it in GitHub Desktop.
Call api wrapper
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
// @flow | |
export class ApiCall { | |
constructor(url: string) { | |
this.url = url; | |
} | |
get = (id?: string) => app.api.get(id ? `${this.url}/${id}` : this.url); | |
post = (body: object = {}) => app.api.post(body); | |
put = (body: object = {}) => app.api.put(body); | |
delete = (id?: string) => app.api.delete(`${this.url}/${id}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment