Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- submit = (event) => {
- //console.log(this.state);
- axios({
- method: 'post',
- url: 'https://uxcandy.com/~shapoval/test-task-backend/create?developer=Agarkova',
- crossDomain: true,
- headers : {
- 'Content-Type': 'multipart/form-data'
- },
- processData: false,
- data: {
- username : "User",
- email: this.state.user.email,
- password : this.state.user.password,
- notes : this.state.user.notes,
- task : this.state.user.task,
- file : this.state.user.file
- },
- config: { headers: {'Content-Type': 'multipart/form-data' },
- onUploadProgress : progressEvent => {
- console.log('Upload Progress:' + Math.round(progressEvent.loaded / progressEvent.total * 100) + '%')
- }
- }
- }).then(function (response) {
- //handle success
- console.log(response.data);
- })
- .catch(function (response) {
- //handle error
- console.log(response);
- });
- }
- let formData = new FormData();
- formData.append('username', "User");
- formData.append('email', this.state.user.email);
- formData.append('password', this.state.user.password);
- formData.append('notes', this.state.user.notes);
- formData.append('task', this.state.user.task);
- formData.append('file', this.state.user.file);
- submit = (event) => {
- //console.log(this.state);
- axios({
- method: 'post',
- url: 'https://uxcandy.com/~shapoval/test-task-backend/create?developer=Agarkova',
- crossDomain: true,
- processData: false,
- data: formData,
- onUploadProgress : progressEvent => {
- console.log('Upload Progress:' + Math.round(progressEvent.loaded / progressEvent.total * 100) + '%')
- }
- }).then(function (response) {
- //handle success
- console.log(response.data);
- }).catch(function (response) {
- //handle error
- console.log(response);
- });
- }
Add Comment
Please, Sign In to add comment