Skip to content

Commit d000169

Browse files
used a new api for email vallidation
the older one now shifted from https to http
1 parent e4387ac commit d000169

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

js/mail.js

+17-19
Original file line numberDiff line numberDiff line change
@@ -69,29 +69,23 @@ export class mail {
6969
}
7070

7171
_isDeliverable(email) {
72-
const requestOptions = {
73-
method: "GET",
74-
redirect: "follow",
75-
};
72+
// const requestOptions = {
73+
// method: "GET",
74+
// redirect: "follow",
75+
// };
7676

7777
return fetch(
78-
`http://api.eva.pingutil.com/email?email=${email}`,
79-
requestOptions
78+
// * fixed. change in validation checking api
79+
`https://open.kickbox.com/v1/disposable/${email}`
80+
// `http://api.eva.pingutil.com/email?email=${email}`,
81+
// requestOptions
8082
)
8183
.then((response) => response.json())
8284
.then((res) => {
83-
if (res.status === "success") {
84-
if (res.data.deliverable) {
85-
this._sendMail();
86-
} else {
87-
//!raise error-solved
88-
if (this.error.classList.contains("success")) {
89-
revertSuccess.call(this, "Invalid email address !!!");
90-
}
91-
this.errorText.textContent = "Invalid email address !!!";
92-
this.error.style.opacity = 1;
93-
throw new Error("email address not delievarable");
94-
}
85+
console.log(res);
86+
console.log(res);
87+
if (!res.disposable) {
88+
this._sendMail();
9589
} else {
9690
//!raise error-solved
9791
if (this.error.classList.contains("success")) {
@@ -104,6 +98,7 @@ export class mail {
10498
})
10599
.catch((err) => {
106100
//!raise error-solved
101+
console.log("errror from line 107");
107102
if (this.error.classList.contains("success")) {
108103
revertSuccess.call(this, ` Error: ${err.message} !!!`);
109104
}
@@ -139,7 +134,10 @@ export class mail {
139134
this.error.style.opacity = 1;
140135
}
141136
})
142-
.catch((err) => console.error(err));
137+
.catch((err) => {
138+
console.log("the error is from line 143");
139+
console.error(err);
140+
});
143141
}
144142
}
145143

0 commit comments

Comments
 (0)