| @@ -134,23 +134,23 @@ export default function JobForm(props) { | |||
| axios.get(`${api_url}/api/job-submissions?filters[Email][$eq]=${values.email}`) | |||
| .then((res) => { | |||
| data = res.data.data[0]; | |||
| //console.log(data.attributes.SubmitDate); | |||
| console.log(data); | |||
| const submitDate = new Date(data.attributes.SubmitDate); | |||
| const now = new Date(); | |||
| if ((now.getMonth() - submitDate.getMonth()) > 1) | |||
| if ((now.getMonth() - submitDate.getMonth()) < 1) | |||
| { | |||
| setErrorMsg('you Already sent an email'); | |||
| } | |||
| else { | |||
| fetch(`${api_url}/api/job-submissions`, { | |||
| fetch(`${api_url}/api/job-submissions/${data.id}`, { | |||
| method: "PUT", | |||
| headers: { | |||
| "Content-type": "application/json; charset=UTF-8", | |||
| }, | |||
| body: JSON.stringify({ | |||
| data: { | |||
| Email: values.email, | |||
| SubmitDate: now, | |||
| } | |||
| }) | |||
| }).then(r => r.json()).then(d => { | |||