diff --git a/package-lock.json b/package-lock.json
index 6d0fd187..7ce002c3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9951,6 +9951,16 @@
"resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz",
"integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM="
},
+ "lodash.reduce": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz",
+ "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs="
+ },
+ "lodash.startswith": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/lodash.startswith/-/lodash.startswith-4.2.1.tgz",
+ "integrity": "sha1-xZjErc4YiiflMUVzHNxsDnF3YAw="
+ },
"lodash.template": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz",
@@ -12768,6 +12778,19 @@
"warning": "^4.0.3"
}
},
+ "react-phone-input-2": {
+ "version": "2.14.0",
+ "resolved": "https://registry.npmjs.org/react-phone-input-2/-/react-phone-input-2-2.14.0.tgz",
+ "integrity": "sha512-gOY3jUpwO7ulryXPEdqzH7L6DPqI9RQxKfBxZbgqAwXyALGsmwLWFyi2RQwXlBLWN/EPPT4Nv6I9TESVY2YBcg==",
+ "requires": {
+ "classnames": "^2.2.6",
+ "lodash.debounce": "^4.0.8",
+ "lodash.memoize": "^4.1.2",
+ "lodash.reduce": "^4.6.0",
+ "lodash.startswith": "^4.2.1",
+ "prop-types": "^15.7.2"
+ }
+ },
"react-redux": {
"version": "7.2.4",
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.4.tgz",
diff --git a/package.json b/package.json
index 6a25ba47..9c433c18 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
"react-bootstrap": "^1.6.0",
"react-dom": "^17.0.2",
"react-loader-spinner": "^4.0.0",
+ "react-phone-input-2": "^2.14.0",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
diff --git a/src/App.js b/src/App.js
index fe3ecdf6..6700b0c0 100644
--- a/src/App.js
+++ b/src/App.js
@@ -24,9 +24,9 @@ const App = () => {
-
+
-
+
Page not found
} />
diff --git a/src/components/Candidate/Candidate.js b/src/components/Candidate/Candidate.js
index 6915ad5e..f98b823b 100644
--- a/src/components/Candidate/Candidate.js
+++ b/src/components/Candidate/Candidate.js
@@ -115,7 +115,7 @@ const Candidate = () => {
{currentCandidateObj.vc_text ? currentCandidateObj.vc_text : 'Описание отсутствует...' }
)}
-
+
diff --git a/src/components/Form/Form.js b/src/components/Form/Form.js
index 5da45005..d492fa30 100644
--- a/src/components/Form/Form.js
+++ b/src/components/Form/Form.js
@@ -2,9 +2,19 @@ import React, { useState } from 'react';
import style from './Form.module.css';
import { fetchForm } from '../../server/server';
import arrow from '../../images/right-arrow.png';
-import { useHistory } from 'react-router-dom';
+import { useHistory, useParams, Redirect } from 'react-router-dom';
+import PhoneInput from 'react-phone-input-2'
+import 'react-phone-input-2/lib/style.css'
+import './form.css';
+
+import { withSwalInstance } from 'sweetalert2-react';
+import swal from 'sweetalert2';
+
+const SweetAlert = withSwalInstance(swal);
const Form = () => {
+ const urlParams = useParams();
+ const [status, setStatus] = useState(null);
const [data, setData] = useState({
email: '',
phone: '',
@@ -26,19 +36,32 @@ const Form = () => {
e.preventDefault();
const formData = new FormData();
+ formData.append('profile_id', urlParams.id);
formData.append('email', data.email);
formData.append('phone', data.phone);
formData.append('comment', data.comment);
- fetchForm(`${process.env.REACT_APP_API_URL}/api/profile/add-to-interview`, formData);
+ fetchForm(`${process.env.REACT_APP_API_URL}/api/profile/add-to-interview`, {
+ profile_id: urlParams.id,
+ ...data,
+ }).then( (res)=> res.json()
+ .then( resJSON => setStatus(resJSON))
+ )
};
const goBack = () => {
history.goBack();
};
+ console.log('s',status)
+
return (
+ {status &&
{setStatus(null);} : () => {setStatus(null); history.push(`/candidate/${urlParams.id}`)}}
+ />}
diff --git a/src/server/server.js b/src/server/server.js
index c120037f..7bedd122 100644
--- a/src/server/server.js
+++ b/src/server/server.js
@@ -55,9 +55,9 @@ export const fetchForm = async (link, info) => {
// 'Access-Control-Request-Headers': 'authorization',
'Authorization': `Bearer ${localStorage.getItem('auth_token')}`,
// 'Origin': `${process.env.REACT_APP_BASE_URL}`,
- 'Content-Type': 'multipart/form-data'
+ 'Content-Type': 'application/json',
},
- body: info
+ body: JSON.stringify(info)
})
return response