mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
26 lines
767 B
TypeScript
26 lines
767 B
TypeScript
import { useMutation } from "@tanstack/react-query";
|
|
import { deployProject } from "@/lib/deploy";
|
|
import { useFS } from "./useFS";
|
|
import { useAppContext } from "./useAppContext";
|
|
import { useCurrentUser } from "./useCurrentUser";
|
|
|
|
export function useDeployProject(projectId: string) {
|
|
const { fs } = useFS();
|
|
const { user } = useCurrentUser();
|
|
const { config } = useAppContext();
|
|
|
|
return useMutation({
|
|
mutationFn: async () => {
|
|
if (!user) {
|
|
throw new Error("You must be logged into Nostr to deploy a project");
|
|
}
|
|
return await deployProject({
|
|
fs,
|
|
projectId: projectId,
|
|
deployServer: config.deployServer,
|
|
projectPath: `/projects/${projectId}`,
|
|
signer: user.signer,
|
|
});
|
|
},
|
|
});
|
|
} |