import './bootstrap';

import { createApp } from "vue";


import vuetify from "./vuetify";

import applienceform from './components/applience/Form.vue';

const app = createApp({
    components: {
        applienceform
    },
    delimiters: ['%%', '%%'],
    methods: {
        axiosPost(url, data, params) {
            return new Promise((resolve, reject) => {
                return axios.post(url, data, {params: params}).then(response => {
                    if(!this.error.display && response.data.message) {
                        this.error = {
                            display: true,
                            message: response.data.message,
                            type: response.data.status === 'Success' ? 'success' : 'error'
                        }
                    }
                    setTimeout(() => { resolve({ response }) },300);
                }).catch(function (error) {
                    reject({
                        title: 'Error!!!',
                        body: error,
                        config: {
                            closeOnClick: true
                        }
                    })
                });
            });
        },
    },
    data: () => ({
        csrfToken: '',
    }),
    mounted() {
        this.csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
    },
});

app.use(vuetify).mount("#app");
