// @ts-ignore
import {defineStore} from 'pinia'
// @ts-ignore
import {useCookie} from '#app'

export const useCallStore = defineStore('call', {
    state: () => ({
        status: false,
        call: {}
    }),
    actions: {
        async init() {
            // @ts-ignore
            if(!this.status) {
               await this.checkCall()
            }
        },
        async checkCall () {
            const {$api} = useNuxtApp();

            // @ts-ignore
            await $api.post('/user/room/check', {}).then((value: { data: { data: null; }; }) => {
                // @ts-ignore
                this.call = value.data.data;
            })
        }
    },
})
