From eab00da2404267d5d707b76e6aec4d854db0d65a Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Thu, 9 Feb 2023 18:52:31 -0500 Subject: [PATCH] [+] Moving through directories --- src/App.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 7ff5bb2..21a7fe5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,10 +1,12 @@ +import urlJoin from 'url-join'; import mime from 'mime'; import moment from 'moment'; import { Component, createResource, createSignal, For, lazy, Show } from 'solid-js'; -const host = "https://daisy-ddns.hydev.org/data/api/OS" +const host = "https://daisy-ddns.hydev.org/data/api" -const fetchApi = async () => await (await fetch(host)).json() +const path = window.location.pathname +const fetchApi = async () => await (await fetch(urlJoin(host, path))).json() function sizeFmt(size: number) { var i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024)); @@ -21,12 +23,6 @@ function getIcon(f) else return '/mime/application-blank.svg' } -function getHref(f) -{ - if (f.type == "directory") return f.name - return f.name -} - export default function App() { const [api] = createResource(fetchApi) @@ -37,7 +33,7 @@ export default function App() { {api.loading && "Loading..."}
{(f, i) => - + {f.name}