Skip to content

Instantly share code, notes, and snippets.

View ntakouris's full-sized avatar
🤖
Building robots

Theodoros Ntakouris ntakouris

🤖
Building robots
View GitHub Profile
axios.get('/user/4567')
.then(function (response) {
// right ?
})
axios.get(baseURL + '/user/' + userId)
.then(function (response) {
// better
})
const ApiBaseUrl = process.env.API_URL
const BasePrefix = '/api'
const Base = ApiBaseUrl + BasePrefix + '/v1'
const NodesBase = Base + '/nodes'
const ApiRoutes = {
ApiBaseUrl: ApiBaseUrl,
Nodes: {
GetAll: NodesBase,
const response = await axios.get(ApiRoutes.Nodes.GetDetailsById(1234))
const AppRoutes = {
Home: {
path: '/',
name: 'Home',
component: Home
},
NodeDetails: {
path: '/nodes/:nodeId',
name: 'Node Details',
component: NodeInfoPage,
navigationRouteOptions: [AppRoutes.Home, AppRoutes.GlobalRegisterView]
// ...snip...
<b-nav-item v-for="route in navigationRouteOptions"
v-bind:key="route.name"
@click="goTo(route.path)">{{ route.name }}</b-nav-item>
methods: {
goBack () {
this.$router.back()
},
goHome () {
this.$router.push(AppRoutes.Home)
},
goTo (routeName) {
this.$router.push(routeName)
}
methods: {
goBack () {
this.$router.back()
},
goHome () {
this.$router.push(AppRoutes.Home)
},
goTo (routeName) {
this.$router.push(routeName)
}
import axios from 'axios'
import ApiRoutes from '@/api/ApiRoutes'
const state = {
nodeList: [],
}
const getters = {}
const actions = {
<template>
<div>
<!-- ... -->
<h2 class="row">Online Nodes</h2>
<div class="row">
<p v-if="error == '' && !loading && nodes.length == 0">No nodes found</p>
<div v-if="!loading && processedNodes.length > 0" class="table-responsive">