implement setting page (#12)

This commit is contained in:
UUBulb
2024-11-23 21:59:48 +08:00
committed by GitHub
parent 34b7a67ab0
commit b474400649
21 changed files with 941 additions and 36 deletions
+4 -1
View File
@@ -3,6 +3,7 @@ import { useNotificationStore } from "./useNotificationStore"
import { getNotificationGroups } from "@/api/notification-group"
import { getNotification } from "@/api/notification"
import { NotificationContextProps } from "@/types"
import { useLocation } from "react-router-dom"
const NotificationContext = createContext<NotificationContextProps>({});
@@ -19,6 +20,8 @@ export const NotificationProvider: React.FC<NotificationProviderProps> = ({ chil
const notifiers = useNotificationStore(store => store.notifiers);
const setNotifier = useNotificationStore(store => store.setNotifier);
const location = useLocation();
useEffect(() => {
if (withNotifierGroup)
(async () => {
@@ -39,7 +42,7 @@ export const NotificationProvider: React.FC<NotificationProviderProps> = ({ chil
setNotifier(undefined);
}
})();
}, [])
}, [location.pathname])
const value: NotificationContextProps = useMemo(() => ({
notifiers: notifiers,
+4 -1
View File
@@ -3,6 +3,7 @@ import { useServerStore } from "./useServerStore"
import { getServerGroups } from "@/api/server-group"
import { getServers } from "@/api/server"
import { ServerContextProps } from "@/types"
import { useLocation } from "react-router-dom"
const ServerContext = createContext<ServerContextProps>({});
@@ -19,6 +20,8 @@ export const ServerProvider: React.FC<ServerProviderProps> = ({ children, withSe
const server = useServerStore(store => store.server);
const setServer = useServerStore(store => store.setServer);
const location = useLocation();
useEffect(() => {
if (withServerGroup)
(async () => {
@@ -39,7 +42,7 @@ export const ServerProvider: React.FC<ServerProviderProps> = ({ children, withSe
setServer(undefined);
}
})();
}, [])
}, [location.pathname])
const value: ServerContextProps = useMemo(() => ({
servers: server,