aboutsummaryrefslogtreecommitdiff
path: root/front-end/src/views/Login/components/Social.vue
blob: 2cea93054229fc44c64b4363ffb207c05c5105ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<template>

    <div class="flex flex-col gap-3">
        <div v-for="method in store.socialOauth.methods" :key="method.Id" class="">
            <button 
            type="submit" 
            class="btn social-button" 
            :disabled="waiting" 
            @click.prevent="submitLogin(method)"
            >
                <fa-icon :icon="['fab', method.Id]" size="xl" />
                Login with {{ capitalize(method.Id) }}
            </button>
        </div>
    </div>

</template>

<script setup lang="ts">
import { apiCall, useWait, type OAuthMethod } from '@vnuge/vnlib.browser'
import { capitalize } from 'lodash-es';
import { useStore } from '../../../store';

const { waiting } = useWait()
const store = useStore()

//Invoke login wrapped in api call
const submitLogin = (method: OAuthMethod) => apiCall(() => store.socialOauth.beginLoginFlow(method))

</script>