const RadiusRadacctModal = { name: 'RadiusRadacctModal', props: { show: Boolean, username: String }, template: `
Status
{{ radacctData.online ? 'Online' : 'Offline' }}
IP
{{ radacctData.ip }}
`, data: () => ({ radacctData: null }), watch: { show(val) { if (val && this.username) { this.fetchRadacctData(); } else { this.radacctData = null; } } }, methods: { async fetchRadacctData() { this.radacctData = null; try { const { data } = await axios.get(`${window.TT_CONFIG.BASE_PATH}/Radius/proxyUnsecureHTTPRequestToRadius`, { params: { action2: 'fetchRadacct', username: this.username } }); this.radacctData = data; } catch (error) { console.error(error); this.radacctData = {}; } } } }; if (window.VueApp) { window.VueApp.component('RadiusRadacctModal', RadiusRadacctModal); }