fix: keep inbox loading without mail states

This commit is contained in:
dreamhunter2333
2026-08-26 00:15:11 +08:00
parent c6196b58de
commit cc75977b6e
4 changed files with 17 additions and 7 deletions
+8 -3
View File
@@ -399,9 +399,14 @@ const multiActionDownload = async () => {
onMounted(async () => {
if (props.enableMailStates) {
const { results = [] } = await props.fetchMailStates()
mailStates.value = results
mailStateFilter.value = results.find(state => state.default)?.value ?? results[0]?.value ?? null
try {
const { results = [] } = await props.fetchMailStates()
mailStates.value = results
mailStateFilter.value = results.find(state => state.default)?.value ?? results[0]?.value ?? null
} catch (error) {
mailStates.value = []
message.error(error.message || "error")
}
}
await refresh();
});
+7 -2
View File
@@ -141,8 +141,13 @@ watch(currentPage, () => {
onMounted(async () => {
await api.getSettings()
if (openSettings.value.enableMailStates) {
const { results = [] } = await api.fetch(`/api/mail-states`)
mailStates.value = results
try {
const { results = [] } = await api.fetch(`/api/mail-states`)
mailStates.value = results
} catch (error) {
mailStates.value = []
message.error(error.message || "error")
}
}
await fetchMails()
@@ -23,7 +23,7 @@ res = requests.get(
After enabling `ENABLE_MAIL_FLAGS` and running the database migration, each mail response includes the boolean field `unread`. The backend owns storage, historical `NULL` compatibility, and state calculation.
With an Address JWT, use `GET /api/mail-states` to retrieve available states. The backend combines its system-state enum with address-specific custom states. The frontend uses each returned `value` directly for filtering and moving, and displays its `label_key` or `label`.
With an Address JWT, use `GET /api/mail-states` to retrieve the currently available system states. This endpoint is the extension point for future address-specific custom states. The frontend uses each returned `value` directly for filtering and moving, and displays its `label_key` or `label`.
Use `PATCH /api/mails/state` to move the state of up to 100 mail IDs:
@@ -23,7 +23,7 @@ res = requests.get(
启用 `ENABLE_MAIL_FLAGS` 并完成数据库迁移后,邮件响应会包含布尔字段 `unread`。数据库存储、历史 `NULL` 兼容和状态计算全部由后端处理。
地址 JWT 使用 `GET /api/mail-states` 获取状态列表。后端将系统状态枚举与地址自定义状态合并后返回;前端直接使用其中的 `value` 作为筛选和移动参数,并使用 `label_key``label` 显示名称。
地址 JWT 使用 `GET /api/mail-states` 获取当前可用的系统状态;该接口也是未来扩展地址自定义状态的入口。前端直接使用其中的 `value` 作为筛选和移动参数,并使用 `label_key``label` 显示名称。
使用 `PATCH /api/mails/state` 批量移动邮件状态,每次最多传入 100 个邮件 ID: