aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/src/components/apidocs/sidebar.vue
blob: dda27226743b2c8a42fe24b23f01b01a7fed7c49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<template>
  <div class="sidebar">
    <div class="sidebar-list">
      <div class="list-group list-group-scroll">
        <a class="list-group-item" v-link="{ path: '/about/api', exact: true }">About API</a>
        <partial name="loading-box" v-if="loading"></partial>
        <template v-for="(name, namespace) in apidocs" v-if="!loading">
          <span class="list-group-head">{{name | capitalize}}</span>
          <a class="list-group-item" v-for="endpoint in namespace" v-link="endpoint_link(endpoint)">{{endpoint_string(endpoint)}}</a>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
import apidocs from "apidocs";

export default {
  data() {
    return {
      apidocs: apidocs.namespaces,
      loading: false,
    };
  },
  methods: {
    endpoint_link(endpoint) {
      return "/about/api/" + endpoint.method.toLowerCase() + "/" + endpoint.path;
    },
    endpoint_string(endpoint) {
      return endpoint.method + " " + endpoint.path;
    },
  },
  created() {
  }
};
</script>