2021-10-04 02:38:45 +00:00
|
|
|
import { BaseAPI } from "./_base";
|
|
|
|
|
|
|
|
const routes = {
|
|
|
|
base: "/api/admin/email",
|
2021-10-05 04:16:37 +00:00
|
|
|
|
|
|
|
invitation: "/api/groups/invitations/email",
|
2021-10-04 02:38:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export interface CheckEmailResponse {
|
|
|
|
ready: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface TestEmailResponse {
|
|
|
|
success: boolean;
|
|
|
|
error: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface TestEmailPayload {
|
|
|
|
email: string;
|
|
|
|
}
|
|
|
|
|
2021-10-05 04:16:37 +00:00
|
|
|
export interface InvitationEmail {
|
|
|
|
email: string;
|
|
|
|
token: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface InvitationEmailResponse {
|
|
|
|
success: boolean;
|
|
|
|
error: string;
|
|
|
|
}
|
|
|
|
|
2021-10-04 02:38:45 +00:00
|
|
|
export class EmailAPI extends BaseAPI {
|
|
|
|
check() {
|
|
|
|
return this.requests.get<CheckEmailResponse>(routes.base);
|
|
|
|
}
|
|
|
|
|
|
|
|
test(payload: TestEmailPayload) {
|
|
|
|
return this.requests.post<TestEmailResponse>(routes.base, payload);
|
|
|
|
}
|
2021-10-05 04:16:37 +00:00
|
|
|
|
|
|
|
sendInvitation(payload: InvitationEmail) {
|
|
|
|
return this.requests.post<InvitationEmailResponse>(routes.invitation, payload);
|
|
|
|
}
|
2021-10-04 02:38:45 +00:00
|
|
|
}
|