Commit 5441891b authored by Oleksii Savran's avatar Oleksii Savran Committed by Matija Obreza
Browse files

Message on Request submitted

parent c951726f
......@@ -210,6 +210,8 @@
"title": "Personal information",
"submit": "Submit request",
"internalExplanation": "If you are requesting material from your own institute please flag the request as internal.",
"successMessage": "Your request is received.",
"checkEmail": "Check your email (and your SPAM folder) for a validation message from Genesys and further instructions.",
"userData": {
"name": "Name",
"surname": "Surname",
......
......@@ -14,6 +14,7 @@ interface IRequestPageState {
requestInfo: Partial<RequestInfo>;
userData: Partial<EasySMTAUserData>;
captcha: string;
success: boolean;
}
interface IRequestPageProps extends WithTranslation, RouteComponentProps {}
......@@ -30,6 +31,7 @@ class RequestPage extends React.Component<IRequestPageProps, IRequestPageState>
// type: 'in',
},
captcha: null,
success: false,
}
}
......@@ -66,7 +68,8 @@ class RequestPage extends React.Component<IRequestPageProps, IRequestPageState>
.initiateRequest(UUIDs, info as RequestInfo, captcha)
.then((data) => {
console.log('request submitted', data);
// clear cart
LocalStorageCart.clearCart();
this.setState({ success: true });
})
.catch((e) => {
console.log('request failed: ', e);
......@@ -97,11 +100,20 @@ class RequestPage extends React.Component<IRequestPageProps, IRequestPageState>
public render() {
const { t } = this.props;
const { apiError, requestInfo, userData, captcha } = this.state;
const { apiError, requestInfo, userData, captcha, success } = this.state;
const { internalRequest } = requestInfo;
const getValueRequest = (name: string) => requestInfo[name] || '';
const getValueUser = (name: string) => userData[name] || '';
if (success) {
return (
<div>
<p>{ t('request.successMessage') }</p>
<p>{ t('request.checkEmail') }</p>
</div>
);
}
return (
<>
<h1>{ t('request.title') }</h1>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment