· 7 years ago · Jun 18, 2018, 08:00 AM
1const data = new FormData();
2data.append("title", this.state.title);
3data.append("file", this.state.file[0]);
4
5export function createDownloadableForm(data) {
6 return (dispatch, getState) => {
7 const { auth: { oauthToken, oauthTokenSecret } } = getState();
8
9 return dispatch({
10 [CALL_API]: {
11 endpoint: "/api/downloadable-forms",
12 method: "POST",
13 headers: {
14 'xoauthtoken': oauthToken,
15 'xoauthtokensecret': oauthTokenSecret,
16 },
17 body: data,
18 types: [CREATE_DOWNLOADABLE_FORMS, CREATE_DOWNLOADABLE_FORMS_SUCCESS, CREATE_DOWNLOADABLE_FORMS_FAILURE]
19 }
20 })
21 }
22}
23
24public function actionCreate()
25{
26 $request = Yii::app()->request;
27 // ?
28}