Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add an image with sweetalert2 working in a Next.js project? #115

Open
nicobonder opened this issue May 2, 2023 · 0 comments
Open

Comments

@nicobonder
Copy link

nicobonder commented May 2, 2023

I am trying to use sweetalert2 with Next.js. When I used React I used to do this:

const registeredMessage = () => {
Swal.fire({
imageUrl: logo,
imageHeight: 150,
imageWidth: 200,
imageAlt: "Thanks for registering.",
title: "NEXT EVENT",
html: "

Now you will receive updates with all our events.

",
footer: "

Thanks for register.

",
});
};

Then in a function, I do something like this:
const handleSubmit = async (e) => {
e.preventDefault();
setError("");
try {
await createUser(email, password);
registeredMessage();
} catch (e) {
setError(e.message);
console.log(e.message);
}
};

But Next.js require to use Image component to show an image. So, how can I include a image in the alert? Sorry if it doesn't have the right style, it is my first question in GitHub.
Thanks.

#sweetAlert2 #Next

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant