u
This commit is contained in:
commit
c570ec514c
550 files changed
+152597
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { httpPostJson } from "@/utils/http";
|
||||
export interface LoginParams {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
export interface LoginResult {
|
||||
id: string;
|
||||
email: string;
|
||||
displayName: string;
|
||||
token: string;
|
||||
isInit: boolean;
|
||||
}
|
||||
export const loginApi = (params: LoginParams) => {
|
||||
return httpPostJson<LoginResult>("/auth/login", params);
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
import { httpGet, httpPostJson, httpDownloadFile, httpPostUpload } from "@/utils/http";
|
||||
import type { EmailFolder, EmailSummary, EmailDetail, EmailFile } from "@/types/email";
|
||||
import type { AxiosResponse, AxiosProgressEvent } from "axios";
|
||||
|
||||
export const getEmailFolderApi = () => {
|
||||
return httpGet<EmailFolder[]>("/email/getFolder");
|
||||
};
|
||||
|
||||
export interface GetEmailSummaryPageParams extends BasePageParams {
|
||||
folderId: string;
|
||||
}
|
||||
|
||||
export const getEmailSummaryPageApi = (params: GetEmailSummaryPageParams) => {
|
||||
return httpPostJson<BasePageResult<EmailSummary>>("/email/summary", params);
|
||||
};
|
||||
|
||||
export const getEmailDetailApi = (emailId: string) => {
|
||||
return httpGet<EmailDetail>(`/email/detail/${emailId}`);
|
||||
};
|
||||
|
||||
export interface DownloadEmailFileParams {
|
||||
uid: string;
|
||||
folderName: string;
|
||||
partIndex: number;
|
||||
}
|
||||
|
||||
export const downloadEmailFileApi = (params: DownloadEmailFileParams): Promise<AxiosResponse<Blob>> => {
|
||||
return httpDownloadFile("/email/download", params);
|
||||
};
|
||||
|
||||
export const initEmailAllDataApi = () => {
|
||||
return httpGet("/email/init");
|
||||
};
|
||||
|
||||
export const uploadTempFile = (file: File, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
|
||||
return httpPostUpload<EmailFile>("/email/upload-temp", formData, onUploadProgress);
|
||||
};
|
||||
|
||||
export const deleteTempFile = (id: string) => {
|
||||
return httpPostJson<void>("/email/delete-temp", {
|
||||
id: id
|
||||
});
|
||||
};
|
||||
|
||||
export interface EmailSentDTO {
|
||||
emailId: string;
|
||||
subject: string; // 邮件主题
|
||||
body: string;
|
||||
from: string;
|
||||
fromName: string;
|
||||
isSingSent: number;
|
||||
isHtml: number;
|
||||
|
||||
toRecipients: string[]; // 收件人
|
||||
ccRecipients: string[]; // 抄送
|
||||
bccRecipients: string[]; // 密送
|
||||
|
||||
attachments: EmailFile[];
|
||||
inlines: EmailFile[];
|
||||
|
||||
isSent: number;
|
||||
}
|
||||
export const sentEmailApi = (params: EmailSentDTO) => {
|
||||
return httpPostJson<EmailSummary>("/email/sent", params);
|
||||
};
|
||||
|
||||
export const testErrorApi = (params: { name: string; age: number }) => {
|
||||
return httpGet<void>("/test", params);
|
||||
};
|
||||
|
||||
export interface UpdateEmailSeenDTO {
|
||||
folderId: string;
|
||||
emailIds: string[];
|
||||
isSeen: number;
|
||||
}
|
||||
|
||||
export const updateEmailSeenApi = (params: UpdateEmailSeenDTO) => {
|
||||
return httpPostJson<void>("/email/updateSeen", params);
|
||||
};
|
||||
|
||||
export interface DeleteEmailParams {
|
||||
folderId: string;
|
||||
emailIds: string[];
|
||||
}
|
||||
export const deleteEmailApi = (params: DeleteEmailParams) => {
|
||||
return httpPostJson<void>("/email/delete", params);
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
import { httpGet, httpPostJson } from "@/utils/http";
|
||||
|
||||
export interface UserAccount {
|
||||
id: string; // 对应 b_id,Long 类型在 TS 中通常用 number 表示
|
||||
email: string; // 对应 b_email
|
||||
password: string; // 对应 b_password
|
||||
displayName: string; // 对应 b_display_name
|
||||
imapHost: string; // 对应 b_imap_host
|
||||
imapPort: string; // 对应 b_imap_port
|
||||
imapSsl: string; // 对应 b_imap_ssl
|
||||
smtpHost: string; // 对应 b_smtp_host
|
||||
smtpPort: string; // 对应 b_smtp_port
|
||||
smtpSsl: string; // 对应 b_smtp_ssl
|
||||
}
|
||||
|
||||
export const getUserAccountDetailApi = () => {
|
||||
return httpGet<UserAccount>("/emailAccount/detail");
|
||||
};
|
||||
|
||||
interface UpdateUserAccountParams {
|
||||
id: string; // 对应 b_id,Long 类型在 TS 中通常用 number 表示
|
||||
password: string; // 对应 b_password
|
||||
displayName: string; // 对应 b_display_name
|
||||
}
|
||||
export const updateUserAccountApi = (params: UpdateUserAccountParams) => {
|
||||
return httpPostJson<void>("/emailAccount/update", params);
|
||||
};
|
||||
Reference in new issue
Block a user