Created
June 20, 2018 12:10
-
-
Save stephandesouza/b7722252419f44b72bad86f6225945e6 to your computer and use it in GitHub Desktop.
vue-mc upload
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
upload() { | |
let data = new FormData(); | |
forEach(this.getSaveData(), function(value, key) { | |
data.append(key, value); | |
}); | |
let method = 'POST', | |
route = this.id ? this.getRoute('patch') : this.getRoute('create'), | |
url = this.getURL(route, this.getRouteParameters()), | |
config = function config() { | |
return { | |
url: url, | |
method: method, | |
data: data, | |
}; | |
}; | |
return this.request(config, this.onSave, this.onSaveSuccess, this.onSaveFailure); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment