mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-07-06 23:01:34 +08:00
fix: 修复前端设置初始化时未返回 domains 数组导致的 undefined 错误 (#997)
This commit is contained in:
@@ -62,8 +62,9 @@ const apiFetch = async (path, options = {}) => {
|
||||
const getOpenSettings = async (message, notification) => {
|
||||
try {
|
||||
const res = await api.fetch("/open_api/settings");
|
||||
const domains = Array.isArray(res["domains"]) ? res["domains"] : [];
|
||||
const domainLabels = res["domainLabels"] || [];
|
||||
if (res["domains"]?.length < 1) {
|
||||
if (domains.length < 1) {
|
||||
message.error("No domains found, please check your worker settings");
|
||||
}
|
||||
Object.assign(openSettings.value, {
|
||||
@@ -75,7 +76,7 @@ const getOpenSettings = async (message, notification) => {
|
||||
needAuth: res["needAuth"] || false,
|
||||
defaultDomains: res["defaultDomains"] || [],
|
||||
randomSubdomainDomains: res["randomSubdomainDomains"] || [],
|
||||
domains: res["domains"].map((domain, index) => {
|
||||
domains: domains.map((domain, index) => {
|
||||
return {
|
||||
label: domainLabels.length > index ? domainLabels[index] : domain,
|
||||
value: domain
|
||||
|
||||
Reference in New Issue
Block a user