mirror of
https://github.com/Damillora/Shioriko.git
synced 2024-11-21 20:07: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 Upload from "./routes/Upload.svelte";
|
||||
import Edit from "./routes/Edit.svelte";
|
||||
import Tags from "./routes/Tags.svelte";
|
||||
|
||||
export let url = "";
|
||||
let baseURL = window.BASE_URL;
|
||||
@ -25,6 +26,7 @@
|
||||
<Route path="/auth/login" component={Login} />
|
||||
<Route path="/auth/logout" component={Logout} />
|
||||
<Route path="/upload" component={Upload} />
|
||||
<Route path="/tags" component={Tags} />
|
||||
</div>
|
||||
</Router>
|
||||
|
||||
|
@ -21,6 +21,11 @@ export async function login({ username, password }) {
|
||||
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 }) {
|
||||
const endpoint = url + "/api/post?page=" + page;
|
||||
const response = await axios.get(endpoint);
|
||||
|
@ -11,6 +11,12 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<section class="hero is-primary">
|
||||
<div class="hero-body">
|
||||
<p class="title">Login</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="container">
|
||||
<form on:submit|preventDefault={doLogin}>
|
||||
<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