const onClick = async (provider: "google" | "apple") => {
const res = await authClient.signIn.social({
provider,
callbackURL: callbackUrl,
});
if (res.error) {
return toast.error(res.error.message);
}
if (!res.data.url) {
return toast.error("Something went wrong. Please try again.");
}
// Failsafe that shouldnt be needed tbh but it also doesnt work
if (res.data.redirect) {
window.location.href = res.data.url;
}
};
const onClick = async (provider: "google" | "apple") => {
const res = await authClient.signIn.social({
provider,
callbackURL: callbackUrl,
});
if (res.error) {
return toast.error(res.error.message);
}
if (!res.data.url) {
return toast.error("Something went wrong. Please try again.");
}
// Failsafe that shouldnt be needed tbh but it also doesnt work
if (res.data.redirect) {
window.location.href = res.data.url;
}
};