feat: add ANNOUNCEMENT (#357)

This commit is contained in:
Dream Hunter
2024-07-22 13:01:38 +08:00
committed by GitHub
parent 384eb9b041
commit 60dda7e3fe
11 changed files with 29 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ import axios from 'axios'
const API_BASE = import.meta.env.VITE_API_BASE || "";
const {
loading, auth, jwt, settings, openSettings,
userOpenSettings, userSettings,
userOpenSettings, userSettings, announcement,
showAuth, adminAuth, showAdminAuth, userJwt
} = useGlobalState();
@@ -56,6 +56,7 @@ const getOpenSettings = async (message) => {
const res = await api.fetch("/open_api/settings");
const domainLabels = res["domainLabels"] || [];
Object.assign(openSettings.value, {
...res,
title: res["title"] || "",
prefix: res["prefix"] || "",
minAddressLen: res["minAddressLen"] || 1,
@@ -81,6 +82,14 @@ const getOpenSettings = async (message) => {
if (openSettings.value.needAuth) {
showAuth.value = true;
}
if (openSettings.value.announcement && openSettings.value.announcement != announcement.value) {
announcement.value = openSettings.value.announcement;
message.info(announcement.value, {
showIcon: false,
duration: 0,
closable: true
});
}
} catch (error) {
message.error(error.message || "error");
}