Last active
September 17, 2022 03:18
-
-
Save iamparthaonline/f8b0c4018fd15f1bf3d3b42ca33785ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div class="app"> | |
| <button | |
| :disabled="loading || !configurationExists" | |
| @click="login" | |
| > | |
| {{ ( loading || !configurationExists ) ? 'Please wait' : 'Continue with Google' }} | |
| </button> | |
| </div> | |
| </template> | |
| <script> | |
| export default { | |
| meteor: { | |
| configurationExists() { | |
| return ServiceConfiguration.configurations.findOne({service: 'google'}); | |
| }, | |
| }, | |
| components: {}, | |
| props: { | |
| loginData: { | |
| type: Object, | |
| }, | |
| }, | |
| data() { | |
| return { | |
| loading: false, | |
| }; | |
| }, | |
| methods: { | |
| login() { | |
| this.loading = true; | |
| Meteor.loginWithGoogle(err => { | |
| if (!err) { | |
| // successful authentication | |
| this.$router.push({name: 'dashboard'}); | |
| } else{ | |
| // failed authentication | |
| alert(err.toString() || 'Unknown Error'); | |
| } | |
| }); | |
| }, | |
| }, | |
| }; | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment