sensitive-blue
sensitive-blue11mo ago

How can I show a success message on successfull registration?

I want the user to confirm their email before allowing them to login, but I need to communicate that to the user somehow, so is it possible to show a notification when registration was successfull (my user is being redirected to login)
4 Replies
kapa.ai
kapa.ai11mo ago
Hi @BlackBearFTW. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, you can show a success message after successful registration in refine. You can use the useRegister hook's onSuccess callback to trigger a notification. However, the extracts provided do not include information on how to display a notification directly after registration. The extracts do show how to use the NotificationProvider with various hooks (useMany, useTable, useShow, useInfiniteList, useOne, useList, useUpdateMany, useForm) to display a success notification after data is fetched or a mutation is successful. Here is an example of how you might use it with the useForm hook:
useForm({
successNotification: (data, values, resource) => {
return {
message: `Successfully created ${data.title}`,
description: "good job!",
type: "success",
};
},
});
useForm({
successNotification: (data, values, resource) => {
return {
message: `Successfully created ${data.title}`,
description: "good job!",
type: "success",
};
},
});
In this example, a success notification is displayed after a successful mutation. The notification's message, description, and type are customizable. You would need to implement a similar pattern with the useRegister hook. Unfortunately, the provided extracts do not include a direct example of this. For more detailed information, you may want to refer to the refine documentation (https://refine.dev/docs). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai11mo ago
<@490961337896402944> kapa.ai is still learning and improving, please let us know how it did by reacting below
sensitive-blue
sensitive-blueOP11mo ago
Eh this doesn't work?
const authProvider: AuthProvider = {
// ...
register: ({ redirectPath }) => {
// ...
return {
success: true,
redirectTo: redirectPath,
successNotification: {
message: "Registration Successful",
description: "You have successfully registered.",
},
};
},
};
const authProvider: AuthProvider = {
// ...
register: ({ redirectPath }) => {
// ...
return {
success: true,
redirectTo: redirectPath,
successNotification: {
message: "Registration Successful",
description: "You have successfully registered.",
},
};
},
};
it doesn't show a success message
tame-yellow
tame-yellow11mo ago
Hello @BlackBearFTW please make sure you are using latest version of refine packages. This feature is released recently, you may have older version.

Did you find this page helpful?