mirror of
https://github.com/danbulant/Mangades
synced 2026-06-17 13:21:03 +00:00
make random a page
This commit is contained in:
parent
fffd98425a
commit
0254300cf1
2 changed files with 8 additions and 8 deletions
|
|
@ -90,13 +90,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
var randomMangaLoading = false;
|
||||
async function randomManga() {
|
||||
randomMangaLoading = true;
|
||||
const res = await request("manga/random");
|
||||
goto("./" + res.data.id);
|
||||
}
|
||||
|
||||
function open() {
|
||||
var id = name;
|
||||
if(id.startsWith("https://mangadex.org/title/")) {
|
||||
|
|
@ -132,7 +125,7 @@
|
|||
</div>
|
||||
|
||||
<div class="flex">
|
||||
<button on:click={randomManga} disabled={randomMangaLoading}>Random</button>
|
||||
<a href="/random" class="button">Random</a>
|
||||
{#if isLogedIn()}
|
||||
{#await userDetails then userDetails}
|
||||
<a href="https://anilist.co/user/{userDetails.data.User.name}" target="_blank">
|
||||
|
|
|
|||
7
src/routes/random/+page.ts
Normal file
7
src/routes/random/+page.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import request from "$lib/util/request";
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
|
||||
export async function load() {
|
||||
const res = await request("manga/random");
|
||||
throw redirect(307, "./" + res.data.id);
|
||||
}
|
||||
Loading…
Reference in a new issue