mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-02-02 16:38:08 +00:00
35 lines
906 B
TypeScript
35 lines
906 B
TypeScript
import { useCallback } from "react";
|
|
import useRouter from "@/hooks/useAppRouter";
|
|
import { tvAccountActionModalAtom } from "@/utils/atoms/tvAccountActionModal";
|
|
import type {
|
|
SavedServer,
|
|
SavedServerAccount,
|
|
} from "@/utils/secureCredentials";
|
|
import { store } from "@/utils/store";
|
|
|
|
interface ShowAccountActionModalParams {
|
|
server: SavedServer;
|
|
account: SavedServerAccount;
|
|
onLogin: () => void;
|
|
onDelete: () => void;
|
|
}
|
|
|
|
export const useTVAccountActionModal = () => {
|
|
const router = useRouter();
|
|
|
|
const showAccountActionModal = useCallback(
|
|
(params: ShowAccountActionModalParams) => {
|
|
store.set(tvAccountActionModalAtom, {
|
|
server: params.server,
|
|
account: params.account,
|
|
onLogin: params.onLogin,
|
|
onDelete: params.onDelete,
|
|
});
|
|
router.push("/tv-account-action-modal");
|
|
},
|
|
[router],
|
|
);
|
|
|
|
return { showAccountActionModal };
|
|
};
|