Initial Firebase refactor pass

This commit is contained in:
Andrew Bastin
2021-06-14 00:07:30 -04:00
parent ced2f1b911
commit 85c6932f8f
30 changed files with 979 additions and 1029 deletions

View File

@@ -6,10 +6,11 @@
</div>
</template>
<script>
import { fb } from "~/helpers/fb"
<script lang="ts">
import Vue from "vue"
import { isSignInWithEmailLink, signInWithEmailLink } from "~/helpers/fb/auth"
export default {
export default Vue.extend({
data() {
return {
signingInWithEmail: false,
@@ -17,14 +18,18 @@ export default {
}
},
async mounted() {
if (fb.isSignInWithEmailLink(window.location.href)) {
if (isSignInWithEmailLink(window.location.href)) {
this.signingInWithEmail = true
let email = window.localStorage.getItem("emailForSignIn")
if (!email) {
email = window.prompt("Please provide your email for confirmation")
email = window.prompt(
"Please provide your email for confirmation"
) as string
}
await fb
.signInWithEmailLink(email, window.location.href)
await signInWithEmailLink(email, window.location.href)
.then(() => {
window.localStorage.removeItem("emailForSignIn")
this.$router.push({ path: "/" })
@@ -38,5 +43,5 @@ export default {
})
}
},
}
})
</script>