Skip to content

Instantly share code, notes, and snippets.

@mickeydarrenlau
Created April 26, 2024 10:50
Show Gist options
  • Save mickeydarrenlau/01ea9e33b565c196bb048016301f75d3 to your computer and use it in GitHub Desktop.
Save mickeydarrenlau/01ea9e33b565c196bb048016301f75d3 to your computer and use it in GitHub Desktop.
Vue error
<template>
<div>
<TunnelsView />
</div>
</template>
<script>
import TunnelsView from './Tunnels.vue';
export default {
name: 'Dashboard',
components: {
TunnelsView
},
data() {
return {}
},
mounted() {
console.log('Dashboard component mounted');
}
}
</script>
<template>
</template>
<script>
import axios from 'axios'
export default {
name: 'Tunnels',
data() {
return {
tunnels: [],
fields: [
{
key: 'name',
label: 'Name'
},
{
key: 'host',
label: 'Host'
},
{
key: 'target',
label: 'Target'
}
],
addtunnelmodalOpen: false,
showOverlayaddtunnel: false,
newTunnel: {
name: '',
host: '',
target: ''
},
hostValidationState: null,
nameValidationState: null,
targetValidationState: null,
firstfetch: true,
}
},
created() {
if (this.firstfetch) {
this.firstfetch = false
this.fetchTunnels()
}
},
methods: {
async fetchTunnels() {
try {
const accessToken = this.$auth.getAccessToken()
const response = await axios.get("https://socksproxyapi.darrenmc.xyz/api/tunnels/list", {
headers: {
Authorization: accessToken
}
})
this.tunnels = response.data
} catch (error) {
console.error("Error fetching tunnels:", error)
}
},
},
watch: {
},
errorCaptured(error, vm, info) {
console.log('errorCaptured', error, info)
return false; // Prevents the error from propagating further
},
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment