Co-authored-by: Ryuno-Ki
This commit is contained in:
parent
7cd87d4c31
commit
db358e4632
1 changed files with 6 additions and 12 deletions
|
@ -5,12 +5,9 @@ export const getEmails = async (toAddr: string) => {
|
||||||
url.pathname = "/email";
|
url.pathname = "/email";
|
||||||
let res = await fetch(url);
|
let res = await fetch(url);
|
||||||
let data = await res.json();
|
let data = await res.json();
|
||||||
let mails = [];
|
const mails = Array.from(data).filter(
|
||||||
Array.from(data).forEach((mail: any) => {
|
(mail: any) => mail.to[0].address === toAddr
|
||||||
if (mail.to[0].address == toAddr) {
|
);
|
||||||
mails.push(mail);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return mails;
|
return mails;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,10 +15,7 @@ export const getActivationLink = async (
|
||||||
toAddr: string
|
toAddr: string
|
||||||
): Promise<string | void> => {
|
): Promise<string | void> => {
|
||||||
let emails = await getEmails(toAddr);
|
let emails = await getEmails(toAddr);
|
||||||
for (let i = 0; i < emails.length; i++) {
|
return emails
|
||||||
let mail = emails[i];
|
.find((mail) => mail.subject.includes("Please activate your account"))
|
||||||
if (mail.subject.includes("Please activate your account")) {
|
.text.split("\n")[4];
|
||||||
return mail.text.split('\n')[4]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue