chore: import upstream snapshot with attribution
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
type Email = {
|
||||
Subject: string;
|
||||
ID: string;
|
||||
From: { Address: string; Name: string };
|
||||
To: Array<{ Address: string; Name: string }>;
|
||||
};
|
||||
|
||||
type AllEmails = {
|
||||
messages: Email[];
|
||||
total: number;
|
||||
count: number;
|
||||
};
|
||||
|
||||
const host = process.env.MAILPIT_HOST || 'localhost';
|
||||
|
||||
export const getAllEmails = async (): Promise<AllEmails> => {
|
||||
const res = await fetch(`http://${host}:8025/api/v1/messages`);
|
||||
return res.json() as Promise<AllEmails>;
|
||||
};
|
||||
|
||||
export const getFirstEmail = (allEmails: { messages: Email[] }) => {
|
||||
return allEmails.messages[0];
|
||||
};
|
||||
|
||||
export const getSubject = (email: { Subject: string }) => {
|
||||
return email.Subject;
|
||||
};
|
||||
|
||||
export const deleteAllEmails = async () => {
|
||||
await fetch(`http://${host}:8025/api/v1/messages`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user