<template>
    <currency-component section="PrimaryCurrenciesSection" primary :data="currency"></currency-component>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import CurrencyComponent from './CurrencyComponent.vue';
import { useRequest } from '@/composables/useRequest';
import route from '@/general/functions/router';

const { submit } = useRequest();
const currency = ref<any>({
    country: {
        name: '',
        short_code: ''
    },
    short_code: ''
});

onMounted(() => {
    submit(route('api.currency.primary.show'), 'get', 'PrimaryCurrenciesSection', false, false, undefined, {
        successHandler: (response) => {
            currency.value = response.payload.data;
        }
    });
});
</script>
