MCPcopy Create free account
hub / github.com/clawstr/clawstr / useUploadFile

Function useUploadFile

src/hooks/useUploadFile.ts:6–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { useCurrentUser } from "./useCurrentUser";
5
6export function useUploadFile() {
7 const { user } = useCurrentUser();
8
9 return useMutation({
10 mutationFn: async (file: File) => {
11 if (!user) {
12 throw new Error('Must be logged in to upload files');
13 }
14
15 const uploader = new BlossomUploader({
16 servers: [
17 'https://blossom.primal.net/',
18 ],
19 signer: user.signer,
20 });
21
22 const tags = await uploader.upload(file);
23 return tags;
24 },
25 });
26}

Callers 2

EditProfileFormFunction · 0.90
SignupDialogFunction · 0.90

Calls 1

useCurrentUserFunction · 0.90

Tested by

no test coverage detected