aboutsummaryrefslogtreecommitdiff
path: root/extension/src/entries/popup/Components/Login.vue
blob: 44df714404019342968e3b49685e357e35d60c6a (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<template>
    <div id="login-template" class="py-4">
        <form class="" @submit.prevent="onSubmit">
            <fieldset class="px-4 input-container">
                <label class="">Please enter your authentication token</label>
                <textarea class="w-full input" v-model="token" rows="5">
                </textarea>
            </fieldset>
            <div class="flex justify-end mt-2">
                <div class="px-3">
                    <button class="w-24 rounded btn sm primary">
                        <fa-icon v-if="waiting" icon="spinner" class="animate-spin" />
                        <span v-else>Submit</span>
                    </button>
                </div>
            </div>
        </form>
    </div>
</template>

<script setup lang="ts">
import { apiCall, useWait } from "@vnuge/vnlib.browser";
import { ref } from "vue";
import { useStore } from "../../store";

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

const token = ref('')

const onSubmit = async () => {
    await apiCall(async ({ toaster }) => {
        await login(token.value)
        toaster.general.success({
            'title': 'Login successful',
            'text': 'Successfully logged into your profile'
        })
    })
 
}

</script>

<style lang="scss">

</style>