tailwind + ky + backend oauth connection
This commit is contained in:
parent
bb557f1fb7
commit
5cc652b0af
8 changed files with 160 additions and 19 deletions
|
@ -1,15 +1,28 @@
|
|||
import { component$ } from "@builder.io/qwik";
|
||||
import { component$, useSignal, useVisibleTask$ } from "@builder.io/qwik";
|
||||
import type { DocumentHead } from "@builder.io/qwik-city";
|
||||
import ky from "ky";
|
||||
import { OAUTH_LINK } from "~/lib/constants";
|
||||
|
||||
export default component$(() => {
|
||||
const files = useSignal<any[]>([]);
|
||||
|
||||
useVisibleTask$(async () => {
|
||||
const res: any[] | undefined = await ky.get("/api/list", { headers: { Authorization: `Bearer ${localStorage.getItem("token")}` } })
|
||||
.json();
|
||||
console.log(res);
|
||||
files.value = res!;
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1>Hi 👋</h1>
|
||||
<div>
|
||||
Can't wait to see what you build with qwik!
|
||||
<br />
|
||||
Happy coding.
|
||||
</div>
|
||||
<a href={OAUTH_LINK}>oauth</a>
|
||||
{files.value.map((file) => (
|
||||
<div key={file.ID}>
|
||||
<h2>Owner: {file.Owner}</h2>
|
||||
<p>File ID: {file.ID}</p>
|
||||
<p>Created: {new Date(file.CreatedAt).toLocaleString()}</p>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue