mirror of
https://github.com/Damillora/Shioriko.git
synced 2024-11-22 12:27:33 +00:00
feat: add tag page
This commit is contained in:
parent
a09058ceb2
commit
5d239b0a05
@ -10,6 +10,7 @@
|
|||||||
import Logout from "./routes/Logout.svelte";
|
import Logout from "./routes/Logout.svelte";
|
||||||
import Upload from "./routes/Upload.svelte";
|
import Upload from "./routes/Upload.svelte";
|
||||||
import Edit from "./routes/Edit.svelte";
|
import Edit from "./routes/Edit.svelte";
|
||||||
|
import Tags from "./routes/Tags.svelte";
|
||||||
|
|
||||||
export let url = "";
|
export let url = "";
|
||||||
let baseURL = window.BASE_URL;
|
let baseURL = window.BASE_URL;
|
||||||
@ -25,6 +26,7 @@
|
|||||||
<Route path="/auth/login" component={Login} />
|
<Route path="/auth/login" component={Login} />
|
||||||
<Route path="/auth/logout" component={Logout} />
|
<Route path="/auth/logout" component={Logout} />
|
||||||
<Route path="/upload" component={Upload} />
|
<Route path="/upload" component={Upload} />
|
||||||
|
<Route path="/tags" component={Tags} />
|
||||||
</div>
|
</div>
|
||||||
</Router>
|
</Router>
|
||||||
|
|
||||||
|
@ -21,6 +21,11 @@ export async function login({ username, password }) {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getTags() {
|
||||||
|
const endpoint = url + "/api/tag";
|
||||||
|
const response = await axios.get(endpoint);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
export async function getPosts({ page }) {
|
export async function getPosts({ page }) {
|
||||||
const endpoint = url + "/api/post?page=" + page;
|
const endpoint = url + "/api/post?page=" + page;
|
||||||
const response = await axios.get(endpoint);
|
const response = await axios.get(endpoint);
|
||||||
|
@ -11,6 +11,12 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<section class="hero is-primary">
|
||||||
|
<div class="hero-body">
|
||||||
|
<p class="title">Login</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<form on:submit|preventDefault={doLogin}>
|
<form on:submit|preventDefault={doLogin}>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
42
web/app/src/routes/Tags.svelte
Normal file
42
web/app/src/routes/Tags.svelte
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<script>
|
||||||
|
import { getTags } from "../api";
|
||||||
|
|
||||||
|
|
||||||
|
let tags = [];
|
||||||
|
|
||||||
|
const getData = async () => {
|
||||||
|
const data = await getTags();
|
||||||
|
tags = data;
|
||||||
|
};
|
||||||
|
$: {
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<section class="hero is-primary">
|
||||||
|
<div class="hero-body">
|
||||||
|
<p class="title">Tags</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section">
|
||||||
|
<div class="container">
|
||||||
|
<table class="table is-fullwidth">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Tag</th>
|
||||||
|
<th>Tag Type</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{#each tags as tag}
|
||||||
|
<tr>
|
||||||
|
<td>{tag.name}</td>
|
||||||
|
<td>{tag.tagType}</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user