Last active
January 1, 2018 22:07
-
-
Save brybrophy/b60ab6db58128b8c8a0b072713280e92 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
export default class UsersApi { | |
constructor(apiCore, basePath) { | |
this._apiCore = apiCore; | |
this._basePath = `${basePath}/users`; | |
} | |
getAll() { | |
return this._apiCore.get(this._basePath); | |
} | |
getOne(userId) { | |
return this._apiCore.get(`${this._basePath}/${userId}`); | |
} | |
create(newUser) { | |
return this._apiCore.post(`${this._basePath}`, newUser); | |
} | |
update(userId, nextUser) { | |
return this._apiCore.put(`${this._basePath}/${userId}`, nextUser); | |
} | |
destroy(userId) { | |
return this._apiCore.delete(`${this._basePath}/${userId}`); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment