Просмотр исходного кода

store dat ain backend

blog-new
Pavle Golubovic 3 лет назад
Родитель
Сommit
8d8784167c
1 измененных файлов: 4 добавлений и 4 удалений
  1. 4
    4
      frontend/src/components/shared/JobForm.jsx

+ 4
- 4
frontend/src/components/shared/JobForm.jsx Просмотреть файл

@@ -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 => {

Загрузка…
Отмена
Сохранить