Skip to content

Commit

Permalink
fix(toast): only once
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 committed Dec 1, 2024
1 parent ddebfc9 commit a2aaacb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Header() {
const { t } = useTranslation();
const navigate = useNavigate();

const { data: settingData,isLoading } = useQuery({
const { data: settingData, isLoading } = useQuery({
queryKey: ["setting"],
queryFn: () => fetchSetting(),
refetchOnMount: true,
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ export default function Servers() {
];

useEffect(() => {
if (readyState == 1) {
const hasShownToast = sessionStorage.getItem("websocket-connected-toast");
if (readyState == 1 && !hasShownToast) {
toast.success(t("info.websocketConnected"));
sessionStorage.setItem("websocket-connected-toast", "true");
}
}, [readyState]);

Expand Down
3 changes: 1 addition & 2 deletions src/types/nezha-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,11 @@ export interface CycleTransferData {
};
}


export interface SettingResponse {
success: boolean;
data: {
language: string;
site_name: string;
custom_code: string;
};
}
}

0 comments on commit a2aaacb

Please sign in to comment.