<template>
    <div class="welcome">
        <span class="text">Success</span>
    </div>
</template>

<script lang="ts" setup>
import { onMounted } from 'vue';
import { setStorage, storageKey } from '../static/utils/storage'

const close = () => {
    window.close()
}

onMounted(() => {
    let url = new URL(window.location.href);
    let search = url.search;
    let urlParams  = new URLSearchParams(search);
    let verifier: any = urlParams.get('oauth_verifier');
    // set
    if (verifier) {
        setStorage(storageKey.verifier, verifier)
        // @ts-ignore
        let time = process.env.NODE_ENV === 'production' ? 200 : 500;
        setTimeout(() => {
            close()
        }, time)
    }
})
</script>

<style lang="less">
body {
    background-color: #F5F5F5;
}

.welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    .text {
        font-size: 22px;
        color: #1D9BF0;
    }
}
</style>