mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 13:40:24 +02:00
refactor api controller to internalize server fetch
This commit is contained in:
@@ -18,7 +18,11 @@ import { Icon } from '/@/shared/components/icon/icon';
|
||||
import { ScrollArea } from '/@/shared/components/scroll-area/scroll-area';
|
||||
import { Stack } from '/@/shared/components/stack/stack';
|
||||
import { Text } from '/@/shared/components/text/text';
|
||||
import { ServerListItem, ServerType } from '/@/shared/types/domain-types';
|
||||
import {
|
||||
ServerListItem,
|
||||
ServerListItemWithCredential,
|
||||
ServerType,
|
||||
} from '/@/shared/types/domain-types';
|
||||
|
||||
const localSettings = isElectron() ? window.api.localSettings : null;
|
||||
|
||||
@@ -69,7 +73,7 @@ function ServerSelector() {
|
||||
const currentServer = useCurrentServer();
|
||||
const { setCurrentServer } = useAuthStoreActions();
|
||||
|
||||
const handleSetCurrentServer = (server: ServerListItem) => {
|
||||
const handleSetCurrentServer = (server: ServerListItemWithCredential) => {
|
||||
navigate(AppRoute.HOME);
|
||||
setCurrentServer(server);
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ import { ServerRequired } from '/@/renderer/features/action-required/components/
|
||||
import { ServerList } from '/@/renderer/features/servers/components/server-list';
|
||||
import { AnimatedPage } from '/@/renderer/features/shared/components/animated-page';
|
||||
import { AppRoute } from '/@/renderer/router/routes';
|
||||
import { useCurrentServer } from '/@/renderer/store';
|
||||
import { useCurrentServerWithCredential } from '/@/renderer/store';
|
||||
import { Button } from '/@/shared/components/button/button';
|
||||
import { Center } from '/@/shared/components/center/center';
|
||||
import { Group } from '/@/shared/components/group/group';
|
||||
@@ -18,7 +18,7 @@ import { Stack } from '/@/shared/components/stack/stack';
|
||||
|
||||
const ActionRequiredRoute = () => {
|
||||
const { t } = useTranslation();
|
||||
const currentServer = useCurrentServer();
|
||||
const currentServer = useCurrentServerWithCredential();
|
||||
const isServerRequired = !currentServer;
|
||||
const isCredentialRequired = currentServer && !currentServer.credential;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user