display vault name on the frontend
This commit is contained in:
parent
8044137531
commit
4a12927b34
2 changed files with 24 additions and 5 deletions
|
@ -24,3 +24,8 @@ export interface IFile {
|
|||
size: number;
|
||||
mtime: string;
|
||||
}
|
||||
|
||||
export interface VaultInfo {
|
||||
name: string | null;
|
||||
location: string;
|
||||
}
|
|
@ -1,6 +1,11 @@
|
|||
<template>
|
||||
<div class="home">
|
||||
<h1>Welcome to UpEnd!</h1>
|
||||
<h1>
|
||||
Welcome to
|
||||
<em v-if="infoData?.name"> "{{ infoData.name }}" </em>
|
||||
<template v-else> UpEnd </template>
|
||||
!
|
||||
</h1>
|
||||
<ul v-if="latestFiles">
|
||||
<li v-for="file in latestFiles" :key="file.hash">
|
||||
<router-link :to="{ name: 'inspect', params: { address: file.hash } }">
|
||||
|
@ -12,10 +17,9 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IFile } from "@/types/base";
|
||||
import { IFile, VaultInfo } from "@/types/base";
|
||||
import useSWRV from "swrv";
|
||||
import { computed, defineComponent } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { fetcher } from "../utils";
|
||||
import { parseISO } from "date-fns";
|
||||
|
||||
|
@ -23,7 +27,11 @@ export default defineComponent({
|
|||
name: "Home",
|
||||
|
||||
setup() {
|
||||
const route = useRoute();
|
||||
const { data: infoData } = useSWRV<VaultInfo, unknown>(
|
||||
"/api/info",
|
||||
fetcher
|
||||
);
|
||||
|
||||
const { data: latestFilesRaw } = useSWRV<IFile[], unknown>(
|
||||
"/api/files/latest",
|
||||
fetcher
|
||||
|
@ -42,10 +50,16 @@ export default defineComponent({
|
|||
});
|
||||
|
||||
return {
|
||||
infoData,
|
||||
latestFiles,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss"></style>
|
||||
<style lang="scss">
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue