Prevent duplicate linking attempts
cgen-fcba06e1c28348139bc678b7ac576922
This commit is contained in:
parent
88dd596990
commit
593e9f2f56
1 changed files with 11 additions and 0 deletions
|
|
@ -320,6 +320,17 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const alreadyLinked = user.identities?.some(
|
||||
(identity: any) => identity.provider === provider,
|
||||
);
|
||||
if (alreadyLinked) {
|
||||
aethexToast.info({
|
||||
title: "Already linked",
|
||||
description: `Your ${provider} account is already connected.`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const { data, error } = (await supabase.auth.linkIdentity({
|
||||
provider,
|
||||
|
|
|
|||
Loading…
Reference in a new issue