Commit b18a9397 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '29-message-on-request-submitted' into 'master'

Resolve "Message on Request submitted"

Closes #29

See merge request !27
parents c951726f 5441891b
...@@ -210,6 +210,8 @@ ...@@ -210,6 +210,8 @@
"title": "Personal information", "title": "Personal information",
"submit": "Submit request", "submit": "Submit request",
"internalExplanation": "If you are requesting material from your own institute please flag the request as internal.", "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": { "userData": {
"name": "Name", "name": "Name",
"surname": "Surname", "surname": "Surname",
......
...@@ -14,6 +14,7 @@ interface IRequestPageState { ...@@ -14,6 +14,7 @@ interface IRequestPageState {
requestInfo: Partial<RequestInfo>; requestInfo: Partial<RequestInfo>;
userData: Partial<EasySMTAUserData>; userData: Partial<EasySMTAUserData>;
captcha: string; captcha: string;
success: boolean;
} }
interface IRequestPageProps extends WithTranslation, RouteComponentProps {} interface IRequestPageProps extends WithTranslation, RouteComponentProps {}
...@@ -30,6 +31,7 @@ class RequestPage extends React.Component<IRequestPageProps, IRequestPageState> ...@@ -30,6 +31,7 @@ class RequestPage extends React.Component<IRequestPageProps, IRequestPageState>
// type: 'in', // type: 'in',
}, },
captcha: null, captcha: null,
success: false,
} }
} }
...@@ -66,7 +68,8 @@ class RequestPage extends React.Component<IRequestPageProps, IRequestPageState> ...@@ -66,7 +68,8 @@ class RequestPage extends React.Component<IRequestPageProps, IRequestPageState>
.initiateRequest(UUIDs, info as RequestInfo, captcha) .initiateRequest(UUIDs, info as RequestInfo, captcha)
.then((data) => { .then((data) => {
console.log('request submitted', data); console.log('request submitted', data);
// clear cart LocalStorageCart.clearCart();
this.setState({ success: true });
}) })
.catch((e) => { .catch((e) => {
console.log('request failed: ', e); console.log('request failed: ', e);
...@@ -97,11 +100,20 @@ class RequestPage extends React.Component<IRequestPageProps, IRequestPageState> ...@@ -97,11 +100,20 @@ class RequestPage extends React.Component<IRequestPageProps, IRequestPageState>
public render() { public render() {
const { t } = this.props; const { t } = this.props;
const { apiError, requestInfo, userData, captcha } = this.state; const { apiError, requestInfo, userData, captcha, success } = this.state;
const { internalRequest } = requestInfo; const { internalRequest } = requestInfo;
const getValueRequest = (name: string) => requestInfo[name] || ''; const getValueRequest = (name: string) => requestInfo[name] || '';
const getValueUser = (name: string) => userData[name] || ''; const getValueUser = (name: string) => userData[name] || '';
if (success) {
return (
<div>
<p>{ t('request.successMessage') }</p>
<p>{ t('request.checkEmail') }</p>
</div>
);
}
return ( return (
<> <>
<h1>{ t('request.title') }</h1> <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