summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/clusters/agents/router.js
blob: 162a91dc300c8bfe309b964c589169cff1ea7d29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

// Vue Router requires a component to render if the route matches, but since we're only using it for
// querystring handling, we'll create an empty component.
const EmptyRouterComponent = {
  render(createElement) {
    return createElement('div');
  },
};

export default () => {
  // Name and path here don't really matter since we're not rendering anything if the route matches.
  const routes = [{ path: '/', name: 'cluster_agents', component: EmptyRouterComponent }];
  return new VueRouter({
    mode: 'history',
    base: window.location.pathname,
    routes,
  });
};