mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Use UrlResolver to resolve api urls based on white labelling rather than updating ApiUrl's export
Keeping an export constant is more predictable and less surprising for most people.
This commit is contained in:
parent
17762ed7b2
commit
7014514654
15
js/app.js
15
js/app.js
@ -14,8 +14,8 @@ import AppConstants from './constants/application_constants';
|
|||||||
|
|
||||||
import { getDefaultSubdomainSettings, getSubdomainSettings } from './utils/constants';
|
import { getDefaultSubdomainSettings, getSubdomainSettings } from './utils/constants';
|
||||||
import { initLogging } from './utils/error';
|
import { initLogging } from './utils/error';
|
||||||
import requests from './utils/requests';
|
|
||||||
import { getCurrentSubdomain } from './utils/url';
|
import { getCurrentSubdomain } from './utils/url';
|
||||||
|
import UrlResolver from './utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
// FIXME: rename these event actions
|
// FIXME: rename these event actions
|
||||||
@ -74,17 +74,8 @@ const AppGateway = {
|
|||||||
AppResolver
|
AppResolver
|
||||||
.resolve(settings)
|
.resolve(settings)
|
||||||
.then(({ apiUrls, redirectRoute, routes }) => {
|
.then(({ apiUrls, redirectRoute, routes }) => {
|
||||||
// Initialize api urls and defaults for outgoing requests
|
// Set url mapping for outgoing api requests
|
||||||
requests.defaults({
|
UrlResolver.setUrlMapping(apiUrls);
|
||||||
urlMap: apiUrls,
|
|
||||||
http: {
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
credentials: 'include'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ReactDOM.render((
|
ReactDOM.render((
|
||||||
<Router history={history}>
|
<Router history={history}>
|
||||||
|
@ -11,7 +11,7 @@ import withContext from '../context/with_context';
|
|||||||
import { currentUserShape } from '../prop_types';
|
import { currentUserShape } from '../prop_types';
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
import ApiUrls from '../../constants/api_urls';
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
const UnConsignRequestButton = React.createClass({
|
const UnConsignRequestButton = React.createClass({
|
||||||
@ -36,7 +36,7 @@ const UnConsignRequestButton = React.createClass({
|
|||||||
handleSuccess={handleSuccess}
|
handleSuccess={handleSuccess}
|
||||||
title={getLangText('Request to Un-Consign')}>
|
title={getLangText('Request to Un-Consign')}>
|
||||||
<UnConsignRequestForm
|
<UnConsignRequestForm
|
||||||
url={ApiUrls.ownership_unconsigns_request}
|
url={resolveUrl('ownership_unconsigns_request')}
|
||||||
id={{'bitcoin_id': edition.bitcoin_id}}
|
id={{'bitcoin_id': edition.bitcoin_id}}
|
||||||
message={`${getLangText('Hi')},
|
message={`${getLangText('Hi')},
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ import Property from '../ascribe_forms/property';
|
|||||||
import AclProxy from '../acl_proxy';
|
import AclProxy from '../acl_proxy';
|
||||||
import withContext from '../context/with_context';
|
import withContext from '../context/with_context';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
import AscribeSpinner from '../ascribe_spinner';
|
import AscribeSpinner from '../ascribe_spinner';
|
||||||
|
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ const Edition = React.createClass({
|
|||||||
placeholder={getLangText('Enter your comments ...')}
|
placeholder={getLangText('Enter your comments ...')}
|
||||||
editable={true}
|
editable={true}
|
||||||
successMessage={getLangText('Private note saved')}
|
successMessage={getLangText('Private note saved')}
|
||||||
url={ApiUrls.note_private_edition} />
|
url={resolveUrl('note_private_edition')} />
|
||||||
<Note
|
<Note
|
||||||
id={() => {return {'bitcoin_id': edition.bitcoin_id}; }}
|
id={() => {return {'bitcoin_id': edition.bitcoin_id}; }}
|
||||||
label={getLangText('Personal note (public)')}
|
label={getLangText('Personal note (public)')}
|
||||||
@ -129,7 +129,7 @@ const Edition = React.createClass({
|
|||||||
editable={!!edition.acl.acl_edit}
|
editable={!!edition.acl.acl_edit}
|
||||||
show={!!(edition.public_note || edition.acl.acl_edit)}
|
show={!!(edition.public_note || edition.acl.acl_edit)}
|
||||||
successMessage={getLangText('Public edition note saved')}
|
successMessage={getLangText('Public edition note saved')}
|
||||||
url={ApiUrls.note_public_edition} />
|
url={resolveUrl('note_public_edition')} />
|
||||||
</CollapsibleParagraph>
|
</CollapsibleParagraph>
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title={getLangText('Further Details')}
|
title={getLangText('Further Details')}
|
||||||
|
@ -26,9 +26,8 @@ import AclProxy from '../acl_proxy';
|
|||||||
import withContext from '../context/with_context';
|
import withContext from '../context/with_context';
|
||||||
import { routerShape } from '../prop_types';
|
import { routerShape } from '../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A component that handles all the actions inside of the edition detail
|
A component that handles all the actions inside of the edition detail
|
||||||
@ -121,7 +120,7 @@ const EditionActionPanel = React.createClass({
|
|||||||
aclObject={edition.acl}
|
aclObject={edition.acl}
|
||||||
aclName="acl_withdraw_transfer">
|
aclName="acl_withdraw_transfer">
|
||||||
<Form
|
<Form
|
||||||
url={ApiUrls.ownership_transfers_withdraw}
|
url={resolveUrl('ownership_transfers_withdraw')}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
className='inline'
|
className='inline'
|
||||||
isInline={true}>
|
isInline={true}>
|
||||||
@ -142,7 +141,7 @@ const EditionActionPanel = React.createClass({
|
|||||||
aclObject={edition.acl}
|
aclObject={edition.acl}
|
||||||
aclName="acl_withdraw_consign">
|
aclName="acl_withdraw_consign">
|
||||||
<Form
|
<Form
|
||||||
url={ApiUrls.ownership_consigns_withdraw}
|
url={resolveUrl('ownership_consigns_withdraw')}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
className='inline'
|
className='inline'
|
||||||
isInline={true}>
|
isInline={true}>
|
||||||
|
@ -6,12 +6,12 @@ import Property from './../ascribe_forms/property';
|
|||||||
|
|
||||||
import ReactS3FineUploader from './../ascribe_uploader/react_s3_fine_uploader';
|
import ReactS3FineUploader from './../ascribe_uploader/react_s3_fine_uploader';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
import AppConstants from '../../constants/application_constants';
|
import AppConstants from '../../constants/application_constants';
|
||||||
import { validationTypes } from '../../constants/uploader_constants';
|
import { validationTypes } from '../../constants/uploader_constants';
|
||||||
|
|
||||||
import { getCookie } from '../../utils/fetch_api';
|
import { getCookie } from '../../utils/fetch_api';
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
const { func, bool, number, object, string, arrayOf } = React.PropTypes;
|
const { func, bool, number, object, string, arrayOf } = React.PropTypes;
|
||||||
@ -75,7 +75,7 @@ let FurtherDetailsFileuploader = React.createClass({
|
|||||||
areAssetsDownloadable
|
areAssetsDownloadable
|
||||||
areAssetsEditable={editable}
|
areAssetsEditable={editable}
|
||||||
createBlobRoutine={{
|
createBlobRoutine={{
|
||||||
url: ApiUrls.blob_otherdatas,
|
url: resolveUrl('blob_otherdatas'),
|
||||||
pieceId: pieceId
|
pieceId: pieceId
|
||||||
}}
|
}}
|
||||||
deleteFile={{
|
deleteFile={{
|
||||||
|
@ -39,11 +39,10 @@ import AscribeSpinner from '../ascribe_spinner';
|
|||||||
import withContext from '../context/with_context';
|
import withContext from '../context/with_context';
|
||||||
import { routerShape } from '../prop_types';
|
import { routerShape } from '../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { setDocumentTitle } from '../../utils/dom';
|
import { setDocumentTitle } from '../../utils/dom';
|
||||||
import { safeMerge } from '../../utils/general';
|
import { safeMerge } from '../../utils/general';
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the component that implements resource/data specific functionality
|
* This is the component that implements resource/data specific functionality
|
||||||
@ -302,7 +301,7 @@ const PieceContainer = React.createClass({
|
|||||||
placeholder={getLangText('Enter your comments ...')}
|
placeholder={getLangText('Enter your comments ...')}
|
||||||
editable={true}
|
editable={true}
|
||||||
successMessage={getLangText('Private note saved')}
|
successMessage={getLangText('Private note saved')}
|
||||||
url={ApiUrls.note_private_piece} />
|
url={resolveUrl('note_private_piece')} />
|
||||||
<Note
|
<Note
|
||||||
id={this.getId}
|
id={this.getId}
|
||||||
label={getLangText('Personal note (public)')}
|
label={getLangText('Personal note (public)')}
|
||||||
@ -311,7 +310,7 @@ const PieceContainer = React.createClass({
|
|||||||
editable={!!piece.acl.acl_edit}
|
editable={!!piece.acl.acl_edit}
|
||||||
show={!!(piece.public_note || piece.acl.acl_edit)}
|
show={!!(piece.public_note || piece.acl.acl_edit)}
|
||||||
successMessage={getLangText('Public note saved')}
|
successMessage={getLangText('Public note saved')}
|
||||||
url={ApiUrls.note_public_piece} />
|
url={resolveUrl('note_public_piece')} />
|
||||||
</CollapsibleParagraph>
|
</CollapsibleParagraph>
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title={getLangText('Further Details')}
|
title={getLangText('Further Details')}
|
||||||
|
@ -16,9 +16,9 @@ import withContext from '../context/with_context';
|
|||||||
import { currentUserShape } from '../prop_types';
|
import { currentUserShape } from '../prop_types';
|
||||||
|
|
||||||
import AppConstants from '../../constants/application_constants';
|
import AppConstants from '../../constants/application_constants';
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getAclFormMessage, getAclFormDataId } from '../../utils/form';
|
import { getAclFormMessage, getAclFormDataId } from '../../utils/form';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
let AclFormFactory = React.createClass({
|
let AclFormFactory = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
@ -86,7 +86,7 @@ let AclFormFactory = React.createClass({
|
|||||||
message={formMessage}
|
message={formMessage}
|
||||||
labels={labels}
|
labels={labels}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
url={ApiUrls.ownership_consigns}
|
url={resolveUrl('ownership_consigns')}
|
||||||
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
||||||
);
|
);
|
||||||
} else if (action === 'acl_unconsign') {
|
} else if (action === 'acl_unconsign') {
|
||||||
@ -94,7 +94,7 @@ let AclFormFactory = React.createClass({
|
|||||||
<UnConsignForm
|
<UnConsignForm
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
url={ApiUrls.ownership_unconsigns}
|
url={resolveUrl('ownership_unconsigns')}
|
||||||
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
||||||
);
|
);
|
||||||
} else if (action === 'acl_transfer') {
|
} else if (action === 'acl_transfer') {
|
||||||
@ -102,7 +102,7 @@ let AclFormFactory = React.createClass({
|
|||||||
<TransferForm
|
<TransferForm
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
url={ApiUrls.ownership_transfers}
|
url={resolveUrl('ownership_transfers')}
|
||||||
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
||||||
);
|
);
|
||||||
} else if (action === 'acl_loan') {
|
} else if (action === 'acl_loan') {
|
||||||
@ -111,8 +111,8 @@ let AclFormFactory = React.createClass({
|
|||||||
email={email}
|
email={email}
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
url={this.isPiece() ? ApiUrls.ownership_loans_pieces
|
url={resolveUrl(this.isPiece() ? 'ownership_loans_pieces'
|
||||||
: ApiUrls.ownership_loans_editions}
|
: 'ownership_loans_editions')}
|
||||||
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
||||||
);
|
);
|
||||||
} else if (action === 'acl_loan_request') {
|
} else if (action === 'acl_loan_request') {
|
||||||
@ -120,7 +120,7 @@ let AclFormFactory = React.createClass({
|
|||||||
<LoanRequestAnswerForm
|
<LoanRequestAnswerForm
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
url={ApiUrls.ownership_loans_pieces_request_confirm}
|
url={resolveUrl('ownership_loans_pieces_request_confirm')}
|
||||||
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
||||||
);
|
);
|
||||||
} else if (action === 'acl_share') {
|
} else if (action === 'acl_share') {
|
||||||
@ -128,8 +128,8 @@ let AclFormFactory = React.createClass({
|
|||||||
<ShareForm
|
<ShareForm
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
url={this.isPiece() ? ApiUrls.ownership_shares_pieces
|
url={resolveUrl(this.isPiece() ? 'ownership_shares_pieces'
|
||||||
: ApiUrls.ownership_shares_editions}
|
: 'ownership_shares_editions')}
|
||||||
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
handleSuccess={showNotification ? this.showSuccessNotification : handleSuccess} />
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,9 +9,9 @@ import GlobalNotificationModel from '../../models/global_notification_model';
|
|||||||
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
||||||
|
|
||||||
import AscribeSpinner from '../ascribe_spinner';
|
import AscribeSpinner from '../ascribe_spinner';
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
let CreateEditionsForm = React.createClass({
|
let CreateEditionsForm = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
@ -40,7 +40,7 @@ let CreateEditionsForm = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.editions}
|
url={resolveUrl('editions')}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
buttons={
|
buttons={
|
||||||
|
@ -11,10 +11,10 @@ import Property from './property';
|
|||||||
import withContext from '../context/with_context';
|
import withContext from '../context/with_context';
|
||||||
import { currentUserShape } from '../prop_types';
|
import { currentUserShape } from '../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
import AppConstants from '../../constants/application_constants';
|
import AppConstants from '../../constants/application_constants';
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
const { bool } = React.PropTypes;
|
const { bool } = React.PropTypes;
|
||||||
@ -50,7 +50,7 @@ const CopyrightAssociationForm = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.users_profile}
|
url={resolveUrl('users_profile')}
|
||||||
getFormData={this.getProfileFormData}
|
getFormData={this.getProfileFormData}
|
||||||
handleSuccess={this.handleSubmitSuccess}>
|
handleSuccess={this.handleSubmitSuccess}>
|
||||||
<Property
|
<Property
|
||||||
|
@ -12,12 +12,12 @@ import InputFineUploader from './input_fineuploader';
|
|||||||
import Form from '../ascribe_forms/form';
|
import Form from '../ascribe_forms/form';
|
||||||
import Property from '../ascribe_forms/property';
|
import Property from '../ascribe_forms/property';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
import AppConstants from '../../constants/application_constants';
|
import AppConstants from '../../constants/application_constants';
|
||||||
import { validationTypes } from '../../constants/uploader_constants';
|
import { validationTypes } from '../../constants/uploader_constants';
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils';
|
import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let CreateContractForm = React.createClass({
|
let CreateContractForm = React.createClass({
|
||||||
@ -64,7 +64,7 @@ let CreateContractForm = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.ownership_contract_list}
|
url={resolveUrl('ownership_contract_list')}
|
||||||
handleSuccess={this.handleCreateSuccess}>
|
handleSuccess={this.handleCreateSuccess}>
|
||||||
<Property
|
<Property
|
||||||
name="blob"
|
name="blob"
|
||||||
@ -76,7 +76,7 @@ let CreateContractForm = React.createClass({
|
|||||||
fileClass: 'contract'
|
fileClass: 'contract'
|
||||||
}}
|
}}
|
||||||
createBlobRoutine={{
|
createBlobRoutine={{
|
||||||
url: ApiUrls.blob_contracts
|
url: resolveUrl('blob_contracts')
|
||||||
}}
|
}}
|
||||||
validation={{
|
validation={{
|
||||||
itemLimit: validationTypes.additionalData.itemLimit,
|
itemLimit: validationTypes.additionalData.itemLimit,
|
||||||
|
@ -8,9 +8,8 @@ import AclInformation from '../ascribe_buttons/acl_information';
|
|||||||
|
|
||||||
import AscribeSpinner from '../ascribe_spinner';
|
import AscribeSpinner from '../ascribe_spinner';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let EditionDeleteForm = React.createClass({
|
let EditionDeleteForm = React.createClass({
|
||||||
@ -40,7 +39,7 @@ let EditionDeleteForm = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.edition_delete}
|
url={resolveUrl('edition_delete')}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
method="delete"
|
method="delete"
|
||||||
handleSuccess={this.props.handleSuccess}
|
handleSuccess={this.props.handleSuccess}
|
||||||
|
@ -8,9 +8,8 @@ import AclInformation from '../ascribe_buttons/acl_information';
|
|||||||
|
|
||||||
import AscribeSpinner from '../ascribe_spinner';
|
import AscribeSpinner from '../ascribe_spinner';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let PieceDeleteForm = React.createClass({
|
let PieceDeleteForm = React.createClass({
|
||||||
@ -31,7 +30,7 @@ let PieceDeleteForm = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.piece}
|
url={resolveUrl('piece')}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
method="delete"
|
method="delete"
|
||||||
handleSuccess={this.props.handleSuccess}
|
handleSuccess={this.props.handleSuccess}
|
||||||
|
@ -14,9 +14,8 @@ import AscribeSpinner from '../ascribe_spinner';
|
|||||||
import withContext from '../context/with_context';
|
import withContext from '../context/with_context';
|
||||||
import { locationShape } from '../prop_types';
|
import { locationShape } from '../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let LoginForm = React.createClass({
|
let LoginForm = React.createClass({
|
||||||
@ -55,7 +54,7 @@ let LoginForm = React.createClass({
|
|||||||
<Form
|
<Form
|
||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref="loginForm"
|
ref="loginForm"
|
||||||
url={ApiUrls.users_login}
|
url={resolveUrl('users_login')}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
autoComplete="on"
|
autoComplete="on"
|
||||||
buttons={
|
buttons={
|
||||||
|
@ -6,10 +6,9 @@ import Form from './form';
|
|||||||
import Property from './property';
|
import Property from './property';
|
||||||
import InputTextAreaToggable from './input_textarea_toggable';
|
import InputTextAreaToggable from './input_textarea_toggable';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import requests from '../../utils/requests';
|
import requests from '../../utils/requests';
|
||||||
import { getLangText } from '../../utils/lang.js';
|
import { getLangText } from '../../utils/lang.js';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let PieceExtraDataForm = React.createClass({
|
let PieceExtraDataForm = React.createClass({
|
||||||
@ -47,7 +46,7 @@ let PieceExtraDataForm = React.createClass({
|
|||||||
disabled={!editable}
|
disabled={!editable}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
handleSuccess={handleSuccess}
|
handleSuccess={handleSuccess}
|
||||||
url={requests.prepareUrl(ApiUrls.piece_extradata, { piece_id: pieceId })}>
|
url={requests.prepareUrl(resolveUrl('piece_extradata'), { piece_id: pieceId })}>
|
||||||
<Property
|
<Property
|
||||||
name={name}
|
name={name}
|
||||||
label={title}>
|
label={title}>
|
||||||
|
@ -14,12 +14,12 @@ import AscribeSpinner from '../ascribe_spinner';
|
|||||||
import withContext from '../context/with_context';
|
import withContext from '../context/with_context';
|
||||||
import { currentUserShape, locationShape } from '../prop_types';
|
import { currentUserShape, locationShape } from '../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
import AppConstants from '../../constants/application_constants';
|
import AppConstants from '../../constants/application_constants';
|
||||||
import { validationParts, validationTypes } from '../../constants/uploader_constants';
|
import { validationParts, validationTypes } from '../../constants/uploader_constants';
|
||||||
|
|
||||||
import { FileStatus, formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils';
|
import { FileStatus, formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils';
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let RegisterPieceForm = React.createClass({
|
let RegisterPieceForm = React.createClass({
|
||||||
@ -138,7 +138,7 @@ let RegisterPieceForm = React.createClass({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.pieces_list}
|
url={resolveUrl('pieces_list')}
|
||||||
handleSuccess={handleSuccess}
|
handleSuccess={handleSuccess}
|
||||||
buttons={
|
buttons={
|
||||||
<FormSubmitButton
|
<FormSubmitButton
|
||||||
@ -168,7 +168,7 @@ let RegisterPieceForm = React.createClass({
|
|||||||
fileClass: 'digitalwork'
|
fileClass: 'digitalwork'
|
||||||
}}
|
}}
|
||||||
createBlobRoutine={{
|
createBlobRoutine={{
|
||||||
url: ApiUrls.blob_digitalworks
|
url: resolveUrl('blob_digitalworks')
|
||||||
}}
|
}}
|
||||||
validation={validationTypes.registerWork}
|
validation={validationTypes.registerWork}
|
||||||
setIsUploadReady={this.setIsUploadReady('digitalWorkKeyReady')}
|
setIsUploadReady={this.setIsUploadReady('digitalWorkKeyReady')}
|
||||||
@ -187,7 +187,7 @@ let RegisterPieceForm = React.createClass({
|
|||||||
ref={ref => this.refs.thumbnailFineUploader = ref}
|
ref={ref => this.refs.thumbnailFineUploader = ref}
|
||||||
fileInputElement={UploadButton({ className: 'btn btn-secondary btn-sm' })}
|
fileInputElement={UploadButton({ className: 'btn btn-secondary btn-sm' })}
|
||||||
createBlobRoutine={{
|
createBlobRoutine={{
|
||||||
url: ApiUrls.blob_thumbnails
|
url: resolveUrl('blob_thumbnails')
|
||||||
}}
|
}}
|
||||||
handleChangedFile={this.handleChangedThumbnail}
|
handleChangedFile={this.handleChangedThumbnail}
|
||||||
onValidationFailed={this.handleThumbnailValidationFailed}
|
onValidationFailed={this.handleThumbnailValidationFailed}
|
||||||
|
@ -6,9 +6,8 @@ import Form from './form';
|
|||||||
|
|
||||||
import AscribeSpinner from '../ascribe_spinner';
|
import AscribeSpinner from '../ascribe_spinner';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
let EditionRemoveFromCollectionForm = React.createClass({
|
let EditionRemoveFromCollectionForm = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
@ -36,7 +35,7 @@ let EditionRemoveFromCollectionForm = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.edition_remove_from_collection}
|
url={resolveUrl('edition_remove_from_collection')}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
method="delete"
|
method="delete"
|
||||||
handleSuccess={this.props.handleSuccess}
|
handleSuccess={this.props.handleSuccess}
|
||||||
|
@ -6,9 +6,8 @@ import Form from './form';
|
|||||||
|
|
||||||
import AscribeSpinner from '../ascribe_spinner';
|
import AscribeSpinner from '../ascribe_spinner';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let PieceRemoveFromCollectionForm = React.createClass({
|
let PieceRemoveFromCollectionForm = React.createClass({
|
||||||
@ -29,7 +28,7 @@ let PieceRemoveFromCollectionForm = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.piece_remove_from_collection}
|
url={resolveUrl('piece_remove_from_collection')}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
method="delete"
|
method="delete"
|
||||||
handleSuccess={this.props.handleSuccess}
|
handleSuccess={this.props.handleSuccess}
|
||||||
|
@ -14,10 +14,9 @@ import NotificationActions from '../../actions/notification_actions';
|
|||||||
import GlobalNotificationModel from '../../models/global_notification_model';
|
import GlobalNotificationModel from '../../models/global_notification_model';
|
||||||
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getAclFormDataId } from '../../utils/form';
|
import { getAclFormDataId } from '../../utils/form';
|
||||||
import { getLangText } from '../../utils/lang.js';
|
import { getLangText } from '../../utils/lang.js';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
let RequestActionForm = React.createClass({
|
let RequestActionForm = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
@ -35,25 +34,30 @@ let RequestActionForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getUrls() {
|
getUrls() {
|
||||||
let urls = {};
|
const urls = {};
|
||||||
|
|
||||||
if (this.props.notifications.action === 'consign') {
|
if (this.props.notifications.action === 'consign') {
|
||||||
urls.accept = ApiUrls.ownership_consigns_confirm;
|
urls.accept = 'ownership_consigns_confirm';
|
||||||
urls.deny = ApiUrls.ownership_consigns_deny;
|
urls.deny = 'ownership_consigns_deny';
|
||||||
} else if (this.props.notifications.action === 'unconsign') {
|
} else if (this.props.notifications.action === 'unconsign') {
|
||||||
urls.accept = ApiUrls.ownership_unconsigns;
|
urls.accept = 'ownership_unconsigns';
|
||||||
urls.deny = ApiUrls.ownership_unconsigns_deny;
|
urls.deny = 'ownership_unconsigns_deny';
|
||||||
} else if (this.props.notifications.action === 'loan' && !this.isPiece()) {
|
} else if (this.props.notifications.action === 'loan' && !this.isPiece()) {
|
||||||
urls.accept = ApiUrls.ownership_loans_confirm;
|
urls.accept = 'ownership_loans_confirm';
|
||||||
urls.deny = ApiUrls.ownership_loans_deny;
|
urls.deny = 'ownership_loans_deny';
|
||||||
} else if (this.props.notifications.action === 'loan' && this.isPiece()) {
|
} else if (this.props.notifications.action === 'loan' && this.isPiece()) {
|
||||||
urls.accept = ApiUrls.ownership_loans_pieces_confirm;
|
urls.accept = 'ownership_loans_pieces_confirm';
|
||||||
urls.deny = ApiUrls.ownership_loans_pieces_deny;
|
urls.deny = 'ownership_loans_pieces_deny';
|
||||||
} else if (this.props.notifications.action === 'loan_request' && this.isPiece()) {
|
} else if (this.props.notifications.action === 'loan_request' && this.isPiece()) {
|
||||||
urls.accept = ApiUrls.ownership_loans_pieces_request_confirm;
|
urls.accept = 'ownership_loans_pieces_request_confirm';
|
||||||
urls.deny = ApiUrls.ownership_loans_pieces_request_deny;
|
urls.deny = 'ownership_loans_pieces_request_deny';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolve the urls
|
||||||
|
Object.entries(urls).forEach(([key, val]) => {
|
||||||
|
urls[key] = resolveUrl(val);
|
||||||
|
});
|
||||||
|
|
||||||
return urls;
|
return urls;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -16,10 +16,9 @@ import AscribeSpinner from '../ascribe_spinner';
|
|||||||
import withContext from '../context/with_context';
|
import withContext from '../context/with_context';
|
||||||
import { routerShape } from '../prop_types';
|
import { routerShape } from '../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { safeMerge } from '../../utils/general';
|
import { safeMerge } from '../../utils/general';
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
const SendContractAgreementForm = React.createClass({
|
const SendContractAgreementForm = React.createClass({
|
||||||
@ -103,7 +102,7 @@ const SendContractAgreementForm = React.createClass({
|
|||||||
<Form
|
<Form
|
||||||
className="ascribe-form-bordered ascribe-form-wrapper"
|
className="ascribe-form-bordered ascribe-form-wrapper"
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.ownership_contract_agreements}
|
url={resolveUrl('ownership_contract_agreements')}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
handleSuccess={this.handleSubmitSuccess}
|
handleSuccess={this.handleSubmitSuccess}
|
||||||
buttons={<button
|
buttons={<button
|
||||||
|
@ -15,9 +15,8 @@ import AscribeSpinner from '../ascribe_spinner';
|
|||||||
import withContext from '../context/with_context';
|
import withContext from '../context/with_context';
|
||||||
import { locationShape } from '../prop_types';
|
import { locationShape } from '../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let SignupForm = React.createClass({
|
let SignupForm = React.createClass({
|
||||||
@ -71,7 +70,7 @@ let SignupForm = React.createClass({
|
|||||||
<Form
|
<Form
|
||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref='form'
|
ref='form'
|
||||||
url={ApiUrls.users_signup}
|
url={resolveUrl('users_signup')}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
buttons={
|
buttons={
|
||||||
|
@ -17,9 +17,8 @@ import AscribeSpinner from '../ascribe_spinner';
|
|||||||
import withContext from '../context/with_context';
|
import withContext from '../context/with_context';
|
||||||
import { currentUserShape, whitelabelShape } from '../prop_types';
|
import { currentUserShape, whitelabelShape } from '../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
let AccountSettings = React.createClass({
|
let AccountSettings = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
@ -49,7 +48,7 @@ let AccountSettings = React.createClass({
|
|||||||
if (currentUser.username) {
|
if (currentUser.username) {
|
||||||
content = (
|
content = (
|
||||||
<Form
|
<Form
|
||||||
url={ApiUrls.users_username}
|
url={resolveUrl('users_username')}
|
||||||
handleSuccess={this.handleSuccess}>
|
handleSuccess={this.handleSuccess}>
|
||||||
<Property
|
<Property
|
||||||
name='username'
|
name='username'
|
||||||
@ -79,7 +78,7 @@ let AccountSettings = React.createClass({
|
|||||||
aclObject={whitelabel}
|
aclObject={whitelabel}
|
||||||
aclName="acl_view_settings_account_hash">
|
aclName="acl_view_settings_account_hash">
|
||||||
<Form
|
<Form
|
||||||
url={ApiUrls.users_profile}
|
url={resolveUrl('users_profile')}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
getFormData={this.getFormDataProfile}>
|
getFormData={this.getFormDataProfile}>
|
||||||
<Property
|
<Property
|
||||||
|
@ -14,10 +14,10 @@ import Property from '../ascribe_forms/property';
|
|||||||
import ActionPanel from '../ascribe_panel/action_panel';
|
import ActionPanel from '../ascribe_panel/action_panel';
|
||||||
import CollapsibleParagraph from '../ascribe_collapsible/collapsible_paragraph';
|
import CollapsibleParagraph from '../ascribe_collapsible/collapsible_paragraph';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
import AscribeSpinner from '../ascribe_spinner';
|
import AscribeSpinner from '../ascribe_spinner';
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let APISettings = React.createClass({
|
let APISettings = React.createClass({
|
||||||
@ -99,7 +99,7 @@ let APISettings = React.createClass({
|
|||||||
title={getLangText('API Integration')}
|
title={getLangText('API Integration')}
|
||||||
defaultExpanded={this.props.defaultExpanded}>
|
defaultExpanded={this.props.defaultExpanded}>
|
||||||
<Form
|
<Form
|
||||||
url={ApiUrls.applications}
|
url={resolveUrl('applications')}
|
||||||
handleSuccess={this.handleCreateSuccess}>
|
handleSuccess={this.handleCreateSuccess}>
|
||||||
<Property
|
<Property
|
||||||
name='name'
|
name='name'
|
||||||
|
@ -10,13 +10,13 @@ import GlobalNotificationActions from '../../actions/global_notification_actions
|
|||||||
import ReactS3FineUploader from '../ascribe_uploader/react_s3_fine_uploader';
|
import ReactS3FineUploader from '../ascribe_uploader/react_s3_fine_uploader';
|
||||||
import UploadButton from '../ascribe_uploader/ascribe_upload_button/upload_button';
|
import UploadButton from '../ascribe_uploader/ascribe_upload_button/upload_button';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
import AppConstants from '../../constants/application_constants';
|
import AppConstants from '../../constants/application_constants';
|
||||||
import { validationTypes } from '../../constants/uploader_constants';
|
import { validationTypes } from '../../constants/uploader_constants';
|
||||||
|
|
||||||
import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils';
|
import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils';
|
||||||
import { getCookie } from '../../utils/fetch_api';
|
import { getCookie } from '../../utils/fetch_api';
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let ContractSettingsUpdateButton = React.createClass({
|
let ContractSettingsUpdateButton = React.createClass({
|
||||||
@ -66,7 +66,7 @@ let ContractSettingsUpdateButton = React.createClass({
|
|||||||
fileClass: 'contract'
|
fileClass: 'contract'
|
||||||
}}
|
}}
|
||||||
createBlobRoutine={{
|
createBlobRoutine={{
|
||||||
url: ApiUrls.blob_contracts
|
url: resolveUrl('blob_contracts')
|
||||||
}}
|
}}
|
||||||
validation={{
|
validation={{
|
||||||
itemLimit: validationTypes.registerWork.itemLimit,
|
itemLimit: validationTypes.registerWork.itemLimit,
|
||||||
|
@ -16,10 +16,10 @@ import AclProxy from '../acl_proxy';
|
|||||||
import ActionPanel from '../ascribe_panel/action_panel';
|
import ActionPanel from '../ascribe_panel/action_panel';
|
||||||
import CollapsibleParagraph from '../ascribe_collapsible/collapsible_paragraph';
|
import CollapsibleParagraph from '../ascribe_collapsible/collapsible_paragraph';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
|
||||||
import AscribeSpinner from '../ascribe_spinner';
|
import AscribeSpinner from '../ascribe_spinner';
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang';
|
import { getLangText } from '../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let WebhookSettings = React.createClass({
|
let WebhookSettings = React.createClass({
|
||||||
@ -143,7 +143,7 @@ let WebhookSettings = React.createClass({
|
|||||||
<AclProxy show={this.state.webhookEvents && this.state.webhookEvents.length > 0}>
|
<AclProxy show={this.state.webhookEvents && this.state.webhookEvents.length > 0}>
|
||||||
<Form
|
<Form
|
||||||
ref="webhookCreateForm"
|
ref="webhookCreateForm"
|
||||||
url={ApiUrls.webhooks}
|
url={resolveUrl('webhooks')}
|
||||||
handleSuccess={this.handleCreateSuccess}>
|
handleSuccess={this.handleCreateSuccess}>
|
||||||
{this.getEvents()}
|
{this.getEvents()}
|
||||||
<Property
|
<Property
|
||||||
|
@ -13,10 +13,9 @@ import AscribeSpinner from './ascribe_spinner';
|
|||||||
import withContext from './context/with_context';
|
import withContext from './context/with_context';
|
||||||
import { locationShape } from './prop_types';
|
import { locationShape } from './prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../constants/api_urls';
|
|
||||||
|
|
||||||
import { setDocumentTitle } from '../utils/dom';
|
import { setDocumentTitle } from '../utils/dom';
|
||||||
import { getLangText } from '../utils/lang';
|
import { getLangText } from '../utils/lang';
|
||||||
|
import { resolveUrl } from '../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let CoaVerifyContainer = React.createClass({
|
let CoaVerifyContainer = React.createClass({
|
||||||
@ -75,7 +74,7 @@ let CoaVerifyForm = React.createClass({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
url={ApiUrls.coa_verify}
|
url={resolveUrl('coa_verify')}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
buttons={
|
buttons={
|
||||||
<button
|
<button
|
||||||
|
@ -12,10 +12,9 @@ import AscribeSpinner from './ascribe_spinner';
|
|||||||
import withContext from './context/with_context';
|
import withContext from './context/with_context';
|
||||||
import { locationShape, routerShape } from './prop_types';
|
import { locationShape, routerShape } from './prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../constants/api_urls';
|
|
||||||
|
|
||||||
import { setDocumentTitle } from '../utils/dom';
|
import { setDocumentTitle } from '../utils/dom';
|
||||||
import { getLangText } from '../utils/lang';
|
import { getLangText } from '../utils/lang';
|
||||||
|
import { resolveUrl } from '../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let PasswordResetContainer = React.createClass({
|
let PasswordResetContainer = React.createClass({
|
||||||
@ -76,7 +75,7 @@ let PasswordRequestResetForm = React.createClass({
|
|||||||
<Form
|
<Form
|
||||||
ref="form"
|
ref="form"
|
||||||
className='ascribe-form-wrapper'
|
className='ascribe-form-wrapper'
|
||||||
url={ApiUrls.users_password_reset_request}
|
url={resolveUrl('users_password_reset_request')}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
buttons={
|
buttons={
|
||||||
<button
|
<button
|
||||||
@ -136,7 +135,7 @@ let PasswordResetForm = withContext(React.createClass({
|
|||||||
<Form
|
<Form
|
||||||
ref="form"
|
ref="form"
|
||||||
className='ascribe-form-wrapper'
|
className='ascribe-form-wrapper'
|
||||||
url={ApiUrls.users_password_reset}
|
url={resolveUrl('users_password_reset')}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={this.handleSuccess}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
buttons={
|
buttons={
|
||||||
|
@ -15,9 +15,8 @@ import Piece from '../../../../../components/ascribe_detail/piece';
|
|||||||
import AscribeSpinner from '../../../../ascribe_spinner';
|
import AscribeSpinner from '../../../../ascribe_spinner';
|
||||||
import withContext from '../../../../context/with_context';
|
import withContext from '../../../../context/with_context';
|
||||||
|
|
||||||
import ApiUrls from '../../../../../constants/api_urls';
|
|
||||||
|
|
||||||
import { getLangText } from '../../../../../utils/lang';
|
import { getLangText } from '../../../../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../../../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let WalletPieceContainer = React.createClass({
|
let WalletPieceContainer = React.createClass({
|
||||||
@ -85,7 +84,7 @@ let WalletPieceContainer = React.createClass({
|
|||||||
placeholder={getLangText('Enter your comments ...')}
|
placeholder={getLangText('Enter your comments ...')}
|
||||||
editable={true}
|
editable={true}
|
||||||
successMessage={getLangText('Private note saved')}
|
successMessage={getLangText('Private note saved')}
|
||||||
url={ApiUrls.note_private_piece} />
|
url={resolveUrl('note_private_piece')} />
|
||||||
</CollapsibleParagraph>
|
</CollapsibleParagraph>
|
||||||
{children}
|
{children}
|
||||||
</Piece>
|
</Piece>
|
||||||
|
@ -12,13 +12,12 @@ import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_de
|
|||||||
import GlobalNotificationModel from '../../../../../../models/global_notification_model';
|
import GlobalNotificationModel from '../../../../../../models/global_notification_model';
|
||||||
import GlobalNotificationActions from '../../../../../../actions/global_notification_actions';
|
import GlobalNotificationActions from '../../../../../../actions/global_notification_actions';
|
||||||
|
|
||||||
import ApiUrls from '../../../../../../constants/api_urls';
|
|
||||||
import AscribeSpinner from '../../../../../ascribe_spinner';
|
import AscribeSpinner from '../../../../../ascribe_spinner';
|
||||||
|
|
||||||
import requests from '../../../../../../utils/requests';
|
|
||||||
|
|
||||||
import { getLangText } from '../../../../../../utils/lang';
|
import { getLangText } from '../../../../../../utils/lang';
|
||||||
import { formSubmissionValidation } from '../../../../../ascribe_uploader/react_s3_fine_uploader_utils';
|
import { formSubmissionValidation } from '../../../../../ascribe_uploader/react_s3_fine_uploader_utils';
|
||||||
|
import requests from '../../../../../../utils/requests';
|
||||||
|
import { resolveUrl } from '../../../../../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let CylandAdditionalDataForm = React.createClass({
|
let CylandAdditionalDataForm = React.createClass({
|
||||||
@ -113,7 +112,7 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref='form'
|
ref='form'
|
||||||
url={requests.prepareUrl(ApiUrls.piece_extradata, { piece_id: piece.id })}
|
url={requests.prepareUrl(resolveUrl('piece_extradata'), { piece_id: piece.id })}
|
||||||
handleSuccess={handleSuccess || this.handleSuccess}
|
handleSuccess={handleSuccess || this.handleSuccess}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
buttons={buttons}
|
buttons={buttons}
|
||||||
|
@ -26,12 +26,11 @@ import SlidesContainer from '../../../../ascribe_slides_container/slides_contain
|
|||||||
import withContext from '../../../../context/with_context';
|
import withContext from '../../../../context/with_context';
|
||||||
import { currentUserShape, locationShape, routerShape, whitelabelShape } from '../../../../prop_types';
|
import { currentUserShape, locationShape, routerShape, whitelabelShape } from '../../../../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../../../../constants/api_urls';
|
|
||||||
|
|
||||||
import { setDocumentTitle } from '../../../../../utils/dom';
|
import { setDocumentTitle } from '../../../../../utils/dom';
|
||||||
import { getAclFormMessage } from '../../../../../utils/form';
|
import { getAclFormMessage } from '../../../../../utils/form';
|
||||||
import { safeMerge } from '../../../../../utils/general';
|
import { safeMerge } from '../../../../../utils/general';
|
||||||
import { getLangText } from '../../../../../utils/lang';
|
import { getLangText } from '../../../../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../../../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
const CylandRegisterPiece = React.createClass({
|
const CylandRegisterPiece = React.createClass({
|
||||||
@ -199,7 +198,7 @@ const CylandRegisterPiece = React.createClass({
|
|||||||
senderName: currentUser.username
|
senderName: currentUser.username
|
||||||
})}
|
})}
|
||||||
id={{piece_id: piece.id}}
|
id={{piece_id: piece.id}}
|
||||||
url={ApiUrls.ownership_loans_pieces}
|
url={resolveUrl('ownership_loans_pieces')}
|
||||||
email={whitelabel.user}
|
email={whitelabel.user}
|
||||||
gallery="Cyland Archive"
|
gallery="Cyland Archive"
|
||||||
startDate={today}
|
startDate={today}
|
||||||
|
@ -10,12 +10,11 @@ import InputTextAreaToggable from '../../../../../ascribe_forms/input_textarea_t
|
|||||||
import GlobalNotificationModel from '../../../../../../models/global_notification_model';
|
import GlobalNotificationModel from '../../../../../../models/global_notification_model';
|
||||||
import GlobalNotificationActions from '../../../../../../actions/global_notification_actions';
|
import GlobalNotificationActions from '../../../../../../actions/global_notification_actions';
|
||||||
|
|
||||||
import ApiUrls from '../../../../../../constants/api_urls';
|
|
||||||
import AscribeSpinner from '../../../../../ascribe_spinner';
|
import AscribeSpinner from '../../../../../ascribe_spinner';
|
||||||
|
|
||||||
import requests from '../../../../../../utils/requests';
|
|
||||||
|
|
||||||
import { getLangText } from '../../../../../../utils/lang';
|
import { getLangText } from '../../../../../../utils/lang';
|
||||||
|
import requests from '../../../../../../utils/requests';
|
||||||
|
import { resolveUrl } from '../../../../../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let IkonotvArtistDetailsForm = React.createClass({
|
let IkonotvArtistDetailsForm = React.createClass({
|
||||||
@ -98,7 +97,7 @@ let IkonotvArtistDetailsForm = React.createClass({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref='form'
|
ref='form'
|
||||||
url={requests.prepareUrl(ApiUrls.piece_extradata, { piece_id: piece.id })}
|
url={requests.prepareUrl(resolveUrl('piece_extradata'), { piece_id: piece.id })}
|
||||||
handleSuccess={handleSuccess || this.handleSuccess}
|
handleSuccess={handleSuccess || this.handleSuccess}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
buttons={buttons}
|
buttons={buttons}
|
||||||
|
@ -10,12 +10,11 @@ import InputTextAreaToggable from '../../../../../ascribe_forms/input_textarea_t
|
|||||||
import GlobalNotificationModel from '../../../../../../models/global_notification_model';
|
import GlobalNotificationModel from '../../../../../../models/global_notification_model';
|
||||||
import GlobalNotificationActions from '../../../../../../actions/global_notification_actions';
|
import GlobalNotificationActions from '../../../../../../actions/global_notification_actions';
|
||||||
|
|
||||||
import ApiUrls from '../../../../../../constants/api_urls';
|
|
||||||
import AscribeSpinner from '../../../../../ascribe_spinner';
|
import AscribeSpinner from '../../../../../ascribe_spinner';
|
||||||
|
|
||||||
import requests from '../../../../../../utils/requests';
|
|
||||||
|
|
||||||
import { getLangText } from '../../../../../../utils/lang';
|
import { getLangText } from '../../../../../../utils/lang';
|
||||||
|
import requests from '../../../../../../utils/requests';
|
||||||
|
import { resolveUrl } from '../../../../../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let IkonotvArtworkDetailsForm = React.createClass({
|
let IkonotvArtworkDetailsForm = React.createClass({
|
||||||
@ -98,7 +97,7 @@ let IkonotvArtworkDetailsForm = React.createClass({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref='form'
|
ref='form'
|
||||||
url={requests.prepareUrl(ApiUrls.piece_extradata, { piece_id: piece.id })}
|
url={requests.prepareUrl(resolveUrl('piece_extradata'), { piece_id: piece.id })}
|
||||||
handleSuccess={handleSuccess || this.handleSuccess}
|
handleSuccess={handleSuccess || this.handleSuccess}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
buttons={buttons}
|
buttons={buttons}
|
||||||
|
@ -24,10 +24,9 @@ import SlidesContainer from '../../../../ascribe_slides_container/slides_contain
|
|||||||
import withContext from '../../../../context/with_context';
|
import withContext from '../../../../context/with_context';
|
||||||
import { currentUserShape, locationShape, routerShape, whitelabelShape } from '../../../../prop_types';
|
import { currentUserShape, locationShape, routerShape, whitelabelShape } from '../../../../prop_types';
|
||||||
|
|
||||||
import ApiUrls from '../../../../../constants/api_urls';
|
|
||||||
|
|
||||||
import { safeMerge } from '../../../../../utils/general';
|
import { safeMerge } from '../../../../../utils/general';
|
||||||
import { getLangText } from '../../../../../utils/lang';
|
import { getLangText } from '../../../../../utils/lang';
|
||||||
|
import { resolveUrl } from '../../../../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
const IkonotvRegisterPiece = React.createClass({
|
const IkonotvRegisterPiece = React.createClass({
|
||||||
@ -193,7 +192,7 @@ const IkonotvRegisterPiece = React.createClass({
|
|||||||
<LoanForm
|
<LoanForm
|
||||||
loanHeading={getLangText('Loan to IkonoTV archive')}
|
loanHeading={getLangText('Loan to IkonoTV archive')}
|
||||||
id={{piece_id: piece.id}}
|
id={{piece_id: piece.id}}
|
||||||
url={ApiUrls.ownership_loans_pieces}
|
url={resolveUrl('ownership_loans_pieces')}
|
||||||
email={whitelabel.user}
|
email={whitelabel.user}
|
||||||
startDate={today}
|
startDate={today}
|
||||||
endDate={endDate}
|
endDate={endDate}
|
||||||
|
@ -13,13 +13,12 @@ import Property from '../../../../../ascribe_forms/property';
|
|||||||
|
|
||||||
import AscribeSpinner from '../../../../../ascribe_spinner';
|
import AscribeSpinner from '../../../../../ascribe_spinner';
|
||||||
|
|
||||||
import ApiUrls from '../../../../../../constants/api_urls';
|
|
||||||
import { validationParts, validationTypes } from '../../../../../../constants/uploader_constants';
|
import { validationParts, validationTypes } from '../../../../../../constants/uploader_constants';
|
||||||
|
|
||||||
import requests from '../../../../../../utils/requests';
|
|
||||||
|
|
||||||
import { formSubmissionValidation } from '../../../../../ascribe_uploader/react_s3_fine_uploader_utils';
|
import { formSubmissionValidation } from '../../../../../ascribe_uploader/react_s3_fine_uploader_utils';
|
||||||
import { getLangText } from '../../../../../../utils/lang';
|
import { getLangText } from '../../../../../../utils/lang';
|
||||||
|
import requests from '../../../../../../utils/requests';
|
||||||
|
import { resolveUrl } from '../../../../../../utils/url_resolver';
|
||||||
|
|
||||||
|
|
||||||
let MarketAdditionalDataForm = React.createClass({
|
let MarketAdditionalDataForm = React.createClass({
|
||||||
@ -153,7 +152,7 @@ let MarketAdditionalDataForm = React.createClass({
|
|||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref='form'
|
ref='form'
|
||||||
key={this.state.forceUpdateKey}
|
key={this.state.forceUpdateKey}
|
||||||
url={requests.prepareUrl(ApiUrls.piece_extradata, { piece_id: pieceId })}
|
url={requests.prepareUrl(resolveUrl('piece_extradata'), { piece_id: pieceId })}
|
||||||
handleSuccess={showNotification ? this.handleSuccessWithNotification : handleSuccess}
|
handleSuccess={showNotification ? this.handleSuccessWithNotification : handleSuccess}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
buttons={buttons}
|
buttons={buttons}
|
||||||
|
@ -4,7 +4,7 @@ import Redirect from 'react-router/es6/Redirect';
|
|||||||
import getWalletApiUrls from './constants/wallet_api_urls';
|
import getWalletApiUrls from './constants/wallet_api_urls';
|
||||||
import getWalletRoutes from './wallet_routes';
|
import getWalletRoutes from './wallet_routes';
|
||||||
|
|
||||||
import { updateApiUrls } from '../../../constants/api_urls';
|
import { mergeWithBaseApiUrls } from '../../../constants/api_urls';
|
||||||
|
|
||||||
|
|
||||||
function resolve(subdomain) {
|
function resolve(subdomain) {
|
||||||
@ -14,7 +14,7 @@ function resolve(subdomain) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
redirectRoute,
|
redirectRoute,
|
||||||
apiUrls: updateApiUrls(getWalletApiUrls(subdomain)),
|
apiUrls: mergeWithBaseApiUrls(getWalletApiUrls(subdomain)),
|
||||||
routes: getWalletRoutes(subdomain)
|
routes: getWalletRoutes(subdomain)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,8 @@ const ApiUrls = {
|
|||||||
'sign_url_s3': AppConstants.serverUrl + '/s3/sign_url/'
|
'sign_url_s3': AppConstants.serverUrl + '/s3/sign_url/'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function mergeWithBaseApiUrls(updatedApiUrls) {
|
||||||
export function updateApiUrls(updatedApiUrls) {
|
return Object.assign({}, ApiUrls, updatedApiUrls);
|
||||||
return Object.assign(ApiUrls, updatedApiUrls);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ApiUrls;
|
export default ApiUrls;
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
import requests from '../utils/requests';
|
import requests from '../utils/requests';
|
||||||
|
|
||||||
import ApiUrls from '../constants/api_urls';
|
|
||||||
|
|
||||||
|
// FIXME: fix query string usage
|
||||||
let OwnershipFetcher = {
|
let OwnershipFetcher = {
|
||||||
/**
|
/**
|
||||||
* Fetch the default, public contract of a user from the API.
|
* Fetch the default, public contract of a user from the API.
|
||||||
*/
|
*/
|
||||||
fetchContract(email) {
|
fetchContract(loanee) {
|
||||||
return requests.get(ApiUrls.blob_contracts + '?loanee=' + email);
|
return requests.get('blob_contracts', { loanee });
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,7 +21,7 @@ let OwnershipFetcher = {
|
|||||||
isPublic,
|
isPublic,
|
||||||
issuer
|
issuer
|
||||||
};
|
};
|
||||||
return requests.get(ApiUrls.ownership_contract_list, queryParams);
|
return requests.get('ownership_contract_list', queryParams);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ let OwnershipFetcher = {
|
|||||||
* Create a contractagreement between the logged-in user and the email from the API with contract.
|
* Create a contractagreement between the logged-in user and the email from the API with contract.
|
||||||
*/
|
*/
|
||||||
createContractAgreement(signee, contractObj) {
|
createContractAgreement(signee, contractObj) {
|
||||||
return requests.post(ApiUrls.ownership_contract_agreements, { body: {signee: signee, contract: contractObj.id }});
|
return requests.post('ownership_contract_agreements', { body: {signee: signee, contract: contractObj.id }});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,27 +41,27 @@ let OwnershipFetcher = {
|
|||||||
accepted,
|
accepted,
|
||||||
pending
|
pending
|
||||||
};
|
};
|
||||||
return requests.get(ApiUrls.ownership_contract_agreements, queryParams);
|
return requests.get('ownership_contract_agreements', queryParams);
|
||||||
},
|
},
|
||||||
|
|
||||||
confirmContractAgreement(contractAgreement) {
|
confirmContractAgreement(contractAgreement) {
|
||||||
return requests.put(ApiUrls.ownership_contract_agreements_confirm, {contract_agreement_id: contractAgreement.id});
|
return requests.put('ownership_contract_agreements_confirm', {contract_agreement_id: contractAgreement.id});
|
||||||
},
|
},
|
||||||
|
|
||||||
denyContractAgreement(contractAgreement) {
|
denyContractAgreement(contractAgreement) {
|
||||||
return requests.put(ApiUrls.ownership_contract_agreements_deny, {contract_agreement_id: contractAgreement.id});
|
return requests.put('ownership_contract_agreements_deny', {contract_agreement_id: contractAgreement.id});
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchLoanPieceRequestList() {
|
fetchLoanPieceRequestList() {
|
||||||
return requests.get(ApiUrls.ownership_loans_pieces_request);
|
return requests.get('ownership_loans_pieces_request');
|
||||||
},
|
},
|
||||||
|
|
||||||
changeContract(contractObj) {
|
changeContract(contractObj) {
|
||||||
return requests.put(ApiUrls.ownership_contract, { body: contractObj, contract_id: contractObj.id });
|
return requests.put('ownership_contract', { body: contractObj, contract_id: contractObj.id });
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteContract(contractObjId) {
|
deleteContract(contractObjId) {
|
||||||
return requests.delete(ApiUrls.ownership_contract, {contract_id: contractObjId});
|
return requests.delete('ownership_contract', {contract_id: contractObjId});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import requests from '../utils/requests';
|
|
||||||
import ApiUrls from '../constants/api_urls';
|
|
||||||
|
|
||||||
import UserActions from '../actions/user_actions';
|
import UserActions from '../actions/user_actions';
|
||||||
|
|
||||||
|
import requests from '../utils/requests';
|
||||||
|
|
||||||
|
|
||||||
const UserSource = {
|
const UserSource = {
|
||||||
lookupCurrentUser: {
|
lookupCurrentUser: {
|
||||||
@ -26,7 +25,7 @@ const UserSource = {
|
|||||||
|
|
||||||
performLogoutCurrentUser: {
|
performLogoutCurrentUser: {
|
||||||
remote() {
|
remote() {
|
||||||
return requests.get(ApiUrls.users_logout);
|
return requests.get('users_logout');
|
||||||
},
|
},
|
||||||
|
|
||||||
success: UserActions.successLogoutCurrentUser,
|
success: UserActions.successLogoutCurrentUser,
|
||||||
|
32
js/utils/url_resolver.js
Normal file
32
js/utils/url_resolver.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
let URL_MAPPING;
|
||||||
|
|
||||||
|
export function resolveUrl(url) {
|
||||||
|
let apiUrl = url;
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
throw new Error('Url was not defined');
|
||||||
|
} else if (!url.match(/^http/)) {
|
||||||
|
apiUrl = URL_MAPPING && URL_MAPPING[url];
|
||||||
|
|
||||||
|
if (!apiUrl) {
|
||||||
|
if (process.env.NODE_ENV === 'production' &&
|
||||||
|
!(URL_MAPPING && Object.keys(URL_MAPPING).length)) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.warn('No url mapping was defined yet for ApiUrlResolver.');
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`Could not find a url mapping for "${url}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return apiUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setUrlMapping(urlMapping) {
|
||||||
|
URL_MAPPING = urlMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setUrlMapping,
|
||||||
|
resolve: resolveUrl
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user