aboutsummaryrefslogtreecommitdiff
path: root/packages/client/src/components
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-07-06 14:55:58 +0200
committerHampusM <hampus@hampusmat.com>2021-07-06 14:55:58 +0200
commitc2dc7906e47a05cecc6350fd6a3d6f6f955a3423 (patch)
tree0f3895eb00783943a13d27235dfd88bcda5a844c /packages/client/src/components
parent49e6ae50447130ba6e2efd2b561f1b1dcc033099 (diff)
Frontend uses shared types
Diffstat (limited to 'packages/client/src/components')
-rw-r--r--packages/client/src/components/CommitPatch.vue20
-rw-r--r--packages/client/src/components/HomeHeader.vue9
2 files changed, 6 insertions, 23 deletions
diff --git a/packages/client/src/components/CommitPatch.vue b/packages/client/src/components/CommitPatch.vue
index a51a6cb..dca886f 100644
--- a/packages/client/src/components/CommitPatch.vue
+++ b/packages/client/src/components/CommitPatch.vue
@@ -2,25 +2,7 @@
import { defineComponent, h, PropType, VNode } from "vue";
import hljs from "highlight.js";
import hljs_languages from "../util/hljs-languages";
-
-type Hunk = {
- new_start: number,
- new_lines_cnt: number,
- new_lines: number[],
- old_start: number,
- old_lines_cnt: number,
- deleted_lines: number[],
- hunk: string
-}
-
-type Patch = {
- additions: number,
- deletions: number,
- from: string,
- to: string,
- too_large: boolean,
- hunks: Hunk[]
-}
+import { Patch } from "shared_types";
export default defineComponent({
name: "CommitPatch",
diff --git a/packages/client/src/components/HomeHeader.vue b/packages/client/src/components/HomeHeader.vue
index 74e90f9..64e70e7 100644
--- a/packages/client/src/components/HomeHeader.vue
+++ b/packages/client/src/components/HomeHeader.vue
@@ -9,6 +9,7 @@
<script lang="ts">
import { defineComponent, ref } from "vue";
+import { Info } from "shared_types";
export default defineComponent({
name: "HomeHeader",
@@ -17,10 +18,10 @@ export default defineComponent({
const about = ref("");
const fetchInfo = async() => {
- const data = await (await fetch(`${window.location.protocol}//${window.location.host}/api/v1/info`)).json();
- console.log(data.data);
- title.value = data.data.title;
- about.value = data.data.about;
+ const info: Info = (await (await fetch(`${window.location.protocol}//${window.location.host}/api/v1/info`)).json()).data;
+
+ title.value = info.title;
+ about.value = info.about;
};
return { title, about, fetchInfo };