fix: link github and google (#2626)

This commit is contained in:
Jesvin Jose
2022-09-06 14:58:46 +05:30
committed by GitHub
parent d51201cdc1
commit 1ac9511c2a
2 changed files with 21 additions and 3 deletions

View File

@@ -128,6 +128,7 @@ import {
currentUser$,
signInWithEmail,
linkWithFBCredential,
linkWithFBCredentialFromAuthError,
getGithubCredentialFromResult,
} from "~/helpers/fb/auth"
import { setLocalConfig } from "~/newstore/localpersistence"
@@ -218,8 +219,6 @@ export default defineComponent({
if (e.code === "auth/account-exists-with-different-credential") {
// Step 2.
// User's email already exists.
// The pending Google credential.
const pendingCred = e.credential
this.$toast.info(`${this.$t("auth.account_exists")}`, {
duration: 0,
closeOnSwipe: false,
@@ -227,7 +226,7 @@ export default defineComponent({
text: `${this.$t("action.yes")}`,
onClick: async (_, toastObject) => {
const { user } = await signInUserWithGoogle()
await linkWithFBCredential(user, pendingCred)
await linkWithFBCredentialFromAuthError(user, e)
this.showLoginSuccess()