mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-08 19:35:14 -05:00
Consolidate frontend types (#1245)
This commit is contained in:
committed by
GitHub
parent
6a88a59981
commit
479900e912
@@ -1,4 +1,7 @@
|
||||
import { BaseAPI } from "../_base";
|
||||
import { EmailInitationResponse, EmailInvitation } from "~/types/api-types/group";
|
||||
import { ForgotPassword } from "~/types/api-types/user";
|
||||
import { EmailTest } from "~/types/api-types/admin";
|
||||
|
||||
const routes = {
|
||||
base: "/api/admin/email",
|
||||
@@ -7,30 +10,16 @@ const routes = {
|
||||
invitation: "/api/groups/invitations/email",
|
||||
};
|
||||
|
||||
export interface EmailResponse {
|
||||
success: boolean;
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface EmailPayload {
|
||||
email: string;
|
||||
}
|
||||
|
||||
export interface InvitationEmail {
|
||||
email: string;
|
||||
token: string;
|
||||
}
|
||||
|
||||
export class EmailAPI extends BaseAPI {
|
||||
test(payload: EmailPayload) {
|
||||
return this.requests.post<EmailResponse>(routes.base, payload);
|
||||
test(payload: EmailTest) {
|
||||
return this.requests.post<EmailInitationResponse>(routes.base, payload);
|
||||
}
|
||||
|
||||
sendInvitation(payload: InvitationEmail) {
|
||||
return this.requests.post<EmailResponse>(routes.invitation, payload);
|
||||
sendInvitation(payload: EmailInvitation) {
|
||||
return this.requests.post<EmailInitationResponse>(routes.invitation, payload);
|
||||
}
|
||||
|
||||
sendForgotPassword(payload: EmailPayload) {
|
||||
return this.requests.post<EmailResponse>(routes.forgotPassword, payload);
|
||||
sendForgotPassword(payload: ForgotPassword) {
|
||||
return this.requests.post<EmailInitationResponse>(routes.forgotPassword, payload);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user