mirror of
https://github.com/danbulant/Mangades
synced 2026-07-06 03:20:42 +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() {
|
function open() {
|
||||||
var id = name;
|
var id = name;
|
||||||
if(id.startsWith("https://mangadex.org/title/")) {
|
if(id.startsWith("https://mangadex.org/title/")) {
|
||||||
|
|
@ -132,7 +125,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<button on:click={randomManga} disabled={randomMangaLoading}>Random</button>
|
<a href="/random" class="button">Random</a>
|
||||||
{#if isLogedIn()}
|
{#if isLogedIn()}
|
||||||
{#await userDetails then userDetails}
|
{#await userDetails then userDetails}
|
||||||
<a href="https://anilist.co/user/{userDetails.data.User.name}" target="_blank">
|
<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