mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-30 23:18:12 +00:00
30 lines
808 B
TypeScript
30 lines
808 B
TypeScript
import { useCallback } from "react";
|
|
import useRouter from "@/hooks/useAppRouter";
|
|
import { tvServerActionModalAtom } from "@/utils/atoms/tvServerActionModal";
|
|
import type { SavedServer } from "@/utils/secureCredentials";
|
|
import { store } from "@/utils/store";
|
|
|
|
interface ShowServerActionModalParams {
|
|
server: SavedServer;
|
|
onLogin: () => void;
|
|
onDelete: () => void;
|
|
}
|
|
|
|
export const useTVServerActionModal = () => {
|
|
const router = useRouter();
|
|
|
|
const showServerActionModal = useCallback(
|
|
(params: ShowServerActionModalParams) => {
|
|
store.set(tvServerActionModalAtom, {
|
|
server: params.server,
|
|
onLogin: params.onLogin,
|
|
onDelete: params.onDelete,
|
|
});
|
|
router.push("/tv-server-action-modal");
|
|
},
|
|
[router],
|
|
);
|
|
|
|
return { showServerActionModal };
|
|
};
|