import { ipcRenderer } from 'electron' ; import { AxiosError } from 'axios' ; import Vue from 'vue' ; import Vuelidate from 'vuelidate' ; import { Appbar } from '@/components' ; import { VueConfirm , VueRequest , vuetify } from '@/plugins' ; import { router } from '@/router' ; import { logger } from '@/utils' ; Vue . use ( Vuelidate ) ; Vue . use ( VueRequest , { baseURL : '/' } ) ; Vue . use ( VueConfirm ) ; Vue . mixin ( { created ( this ) { this . $on ( 'ipc:on' , ( channel , callback ) => { ipcRenderer . on ( channel , callback ) ; } ) ; this . $on ( 'ipc:send' , ( channel , ... args ) => { ipcRenderer . send ( channel , ... args ) ; } ) ; } , methods : { alert ( message ) { this . $root . alert ( message ) ; } , httpErr ( err ) { logger . error ( err , err . response ) ; this . $root . alert ( ( err . response ?. status === 400 ) ? `${ err . response . data . error }: ${ err . response . data . message }` : err . message ) ; } , } , } ) ; new Vue ( { el : '#yourappid' , vuetify , router , data : { loading : true , showAlert : false , message : '' } , components : { appbar : Appbar , } , created ( this ) { this . $emit ( 'ipc:on' , 'router:replace' , async ( event , path ) => { await router . replace ( path ) ; } ) ; } , mounted ( ) { logger . info ( 'Mounted' ) ; } , methods : { alert ( message ) { this . message = message ; this . showAlert = true ; } , } , } ) ;