Skip to content

Commit

Permalink
Removing some notifications from posting process
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Nov 24, 2024
1 parent d90e9b8 commit 9c6719e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/nextjs/app/create/_components/ImageUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ export const ImageUploader: React.FC<ImageUploaderProps> = ({ image, setUploaded

// Upload file to Pinata
setLoading(true);
const notificationId = notification.loading("Uploading image to Pinata...");
// const notificationId = notification.loading("Uploading image to Pinata...");
try {
const response = await uploadToPinata(file);
notification.success("Image uploaded to Pinata!");
// notification.success("Image uploaded to Pinata!");
setUploadedImageIpfsPath(response.IpfsHash); // Store IPFS hash for later use
setLoading(false);
notification.remove(notificationId);
// notification.remove(notificationId);
} catch (error) {
console.error("Error uploading image to Pinata:", error);
notification.error("Failed to upload image to Pinata.");
setLoading(false);
notification.remove(notificationId);
// notification.remove(notificationId);
}
};

Expand Down
8 changes: 4 additions & 4 deletions packages/nextjs/app/create/_components/MintingButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ export const MintingButtons: React.FC<MintingFormProps> = ({ yourJSON, resetForm
const [loading, setLoading] = useState(false);

const uploadToIPFS = async () => {
const notificationId = notification.loading("Uploading to Pinata...");
// const notificationId = notification.loading("Uploading to Pinata...");
try {
const file = new Blob([JSON.stringify(yourJSON)], { type: "application/json" });
const fileName = "PunkPostMetadata.json"; // Provide a desired file name
const modifiedFile = new File([file], fileName, { lastModified: Date.now() });
const uploadedItem = await uploadToPinata(modifiedFile);
notification.remove(notificationId);
notification.success("Metadata uploaded to Pinata");
// notification.remove(notificationId);
// notification.success("Metadata uploaded to Pinata");

return uploadedItem.IpfsHash;
} catch (error) {
notification.remove(notificationId);
// notification.remove(notificationId);
notification.error("Failed to upload to Pinata");
throw error;
}
Expand Down

0 comments on commit 9c6719e

Please sign in to comment.