Adrià Vilanova Martínez | f7ee658 | 2021-09-02 21:53:28 +0200 | [diff] [blame] | 1 | <script> |
Adrià Vilanova Martínez | e877a00 | 2021-09-03 22:03:01 +0200 | [diff] [blame^] | 2 | import config from './config.js'; |
Adrià Vilanova Martínez | f7ee658 | 2021-09-02 21:53:28 +0200 | [diff] [blame] | 3 | |
| 4 | export default { |
| 5 | mounted() { |
| 6 | if (document.readyState == 'complete') |
| 7 | this.init(); |
| 8 | else |
| 9 | window.addEventListener('load', () => this.init()); |
| 10 | }, |
| 11 | methods: { |
| 12 | init() { |
| 13 | window.google.accounts.id.initialize({ |
| 14 | client_id: config.google.clientId, |
| 15 | callback: this.onSignIn, |
| 16 | }); |
| 17 | window.google.accounts.id.renderButton(document.getElementById('gsi-button'), { |
| 18 | theme: 'outline', |
| 19 | size: 'large', |
| 20 | }); |
| 21 | }, |
| 22 | onSignIn(response) { |
| 23 | this.$emit('on-signin', response); |
| 24 | }, |
| 25 | }, |
| 26 | }; |
| 27 | </script> |
| 28 | |
| 29 | <template> |
| 30 | <div id="gsi-button"></div> |
| 31 | </template> |