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";
|
||||
let res = await fetch(url);
|
||||
let data = await res.json();
|
||||
let mails = [];
|
||||
Array.from(data).forEach((mail: any) => {
|
||||
if (mail.to[0].address == toAddr) {
|
||||
mails.push(mail);
|
||||
}
|
||||
});
|
||||
const mails = Array.from(data).filter(
|
||||
(mail: any) => mail.to[0].address === toAddr
|
||||
);
|
||||
return mails;
|
||||
};
|
||||
|
||||
|
@ -18,10 +15,7 @@ export const getActivationLink = async (
|
|||
toAddr: string
|
||||
): Promise<string | void> => {
|
||||
let emails = await getEmails(toAddr);
|
||||
for (let i = 0; i < emails.length; i++) {
|
||||
let mail = emails[i];
|
||||
if (mail.subject.includes("Please activate your account")) {
|
||||
return mail.text.split('\n')[4]
|
||||
}
|
||||
}
|
||||
return emails
|
||||
.find((mail) => mail.subject.includes("Please activate your account"))
|
||||
.text.split("\n")[4];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue