-
-
Save fpontef/def02f0820dd3f51bc8e7e5e672596a0 to your computer and use it in GitHub Desktop.
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
| const stringfy = (value) => JSON.stringify([value]); | |
| const stringfyAndTransformToObject = (value) => ({ object: stringfy(value) }) | |
| const makeRequest = () => { | |
| const context = arguments[0] || this; | |
| const post = (url, data, options) => context.$http(url, stringfyAndTransformToObject(data), options); | |
| return { post }; | |
| }; | |
| const install = (VueInstance) => { | |
| Object.defineProperties(VueInstance.prototype, { | |
| $request: { | |
| get() { | |
| return makeLoader(this); | |
| }, | |
| }, | |
| }); | |
| }; | |
| export default { install }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment