Created
March 20, 2019 22:51
-
-
Save RiFi2k/5a5a806292e1d6cf9dc7416b81c1b7f8 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
import Qs from 'qs'; | |
import axios from 'axios'; | |
// Axios defaults. | |
axios.defaults.baseURL = smu.siteurl; | |
axios.defaults.headers.post['Content-Type'] = | |
'application/x-www-form-urlencoded'; | |
axios.defaults.transformRequest = data => Qs.stringify(data); | |
// Async await request | |
const [initErr, initResponse] = await to( | |
this.$http.post(smu.ajaxurl, { | |
action: 'init_task', | |
task_screen: 'edit', | |
task_id: this.task.id | |
}) | |
); | |
if (initErr) throw new Error('Failed on ajax callback init_task'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment