API.js 519 B

12345678910111213141516171819202122
  1. function generateRandomCode() {
  2. let code = "";
  3. for (let i = 0; i < 6; i++) {
  4. code += Math.floor(Math.random() * 10);
  5. }
  6. return code;
  7. }
  8. const sendEmail = async() =>{
  9. let emailClient = document.querySelector('.enter').value;
  10. const response = await fetch('https://iis.ngknn.ru/NGKNN/МамшеваЮС/MedicMadlab/api/SendCode', {
  11. headers: {
  12. 'User-email': emailClient
  13. }
  14. })
  15. if(!response.ok)
  16. {
  17. throw Error (':(')
  18. }
  19. return response.json()
  20. }