Add file uploads with Blossom

This commit is contained in:
Alex Gleason committed 2025-05-14 17:15:00 -05:00
1 parent f77a6a4af3
commit 601b3ce370
5 files changed
+185 -71

No files matched your search

+24
View File
@@ -292,6 +292,30 @@ function EditProfilePage() {
The `EditProfileForm` component displays just the form. It requires no props, and will "just work" automatically.
## Uploading Files
Use the `useUploadFile` hook to upload files.
```tsx
import { useUploadFile } from "@/hooks/useUploadFile";
function MyComponent() {
const { mutateAsync: uploadFile, isPending: isUploading } = useUploadFile();
const handleUpload = async (file: File) => {
try {
// The first tuple in the array contains the URL
const [[_, url]] = await uploadFile(file);
// ...use the url
} catch (error) {
// ...handle errors
}
};
// ...rest of component
}
```
## Development Practices
- Uses React Query for data fetching and caching