mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
Add conditional redirect after successful registration
This commit is contained in:
parent
dced59237b
commit
be7fa0c6eb
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { History } from 'react-router';
|
||||||
|
|
||||||
import Form from '../../../../../ascribe_forms/form';
|
import Form from '../../../../../ascribe_forms/form';
|
||||||
import Property from '../../../../../ascribe_forms/property';
|
import Property from '../../../../../ascribe_forms/property';
|
||||||
@ -29,6 +30,8 @@ const PRRegisterPieceForm = React.createClass({
|
|||||||
currentUser: object
|
currentUser: object
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mixins: [History],
|
||||||
|
|
||||||
getInitialState(){
|
getInitialState(){
|
||||||
return {
|
return {
|
||||||
isUploadReady: false,
|
isUploadReady: false,
|
||||||
@ -47,7 +50,8 @@ const PRRegisterPieceForm = React.createClass({
|
|||||||
digitalWorkForm,
|
digitalWorkForm,
|
||||||
proofOfPaymentForm,
|
proofOfPaymentForm,
|
||||||
supportingMaterialsForm,
|
supportingMaterialsForm,
|
||||||
additionalDataForm } = this.refs;
|
additionalDataForm,
|
||||||
|
thumbnailForm } = this.refs;
|
||||||
const additionalDataFormData = additionalDataForm.getFormData();
|
const additionalDataFormData = additionalDataForm.getFormData();
|
||||||
|
|
||||||
// composing data for piece registration
|
// composing data for piece registration
|
||||||
@ -65,10 +69,10 @@ const PRRegisterPieceForm = React.createClass({
|
|||||||
}, () => {
|
}, () => {
|
||||||
supportingMaterialsForm.createBlobRoutine();
|
supportingMaterialsForm.createBlobRoutine();
|
||||||
proofOfPaymentForm.createBlobRoutine();
|
proofOfPaymentForm.createBlobRoutine();
|
||||||
//thumbnailForm.createBlobRoutine();
|
thumbnailForm.createBlobRoutine();
|
||||||
});
|
});
|
||||||
|
|
||||||
setCookie(currentUser.email, piece.id);
|
//setCookie(currentUser.email, piece.id);
|
||||||
|
|
||||||
return requests.post(ApiUrls.piece_extradata, {
|
return requests.post(ApiUrls.piece_extradata, {
|
||||||
body: {
|
body: {
|
||||||
@ -82,6 +86,7 @@ const PRRegisterPieceForm = React.createClass({
|
|||||||
GlobalNotificationActions.appendGlobalNotification(notificationMessage);
|
GlobalNotificationActions.appendGlobalNotification(notificationMessage);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.then(() => this.history.pushState(null, `/pieces/${this.state.piece.id}`))
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
@ -99,7 +104,7 @@ const PRRegisterPieceForm = React.createClass({
|
|||||||
};
|
};
|
||||||
} else if(fileClass === 'thumbnail') {
|
} else if(fileClass === 'thumbnail') {
|
||||||
return {
|
return {
|
||||||
url: ApiUrls.blob_thumbnail,
|
url: ApiUrls.blob_thumbnails,
|
||||||
pieceId: piece.id
|
pieceId: piece.id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user