using access token in header!

This commit is contained in:
2025-09-15 21:50:15 +01:00
parent 29c56bee1c
commit e28d9e5d16
3 changed files with 40 additions and 4 deletions

View File

@@ -11,13 +11,19 @@ type ImageComponentProps = {
export const ImageComponent: Component<ImageComponentProps> = (props) => {
const [isOpen, setIsOpen] = createSignal(false);
// TODO: make sure this is up to date. Put it behind a resource.
const accessToken = localStorage.getItem("access");
if (accessToken == null) {
return <>Ermm... Access token is not set :(</>
}
return (
<>
<div class="relative w-full flex justify-center h-[300px]">
<A href={`/image/${props.ID}`} class="flex w-full">
<img
class="flex w-full object-cover rounded-xl"
src={`${base}/images/${props.ID}`}
src={`${base}/images/${props.ID}?token=${accessToken}`}
/>
</A>
<button
@@ -56,16 +62,25 @@ export const ImageComponent: Component<ImageComponentProps> = (props) => {
);
};
// TODO: these two components are basically identical
// merge the fuckers
export const ImageComponentFullHeight: Component<ImageComponentProps> = (props) => {
const [isOpen, setIsOpen] = createSignal(false);
// TODO: make sure this is up to date. Put it behind a resource.
const accessToken = localStorage.getItem("access");
if (accessToken == null) {
return <>Ermm... Access token is not set :(</>
}
return (
<>
<div class="relative w-full flex justify-center">
<A href={`/image/${props.ID}`} class="flex w-full">
<img
class="flex w-full object-cover rounded-xl"
src={`${base}/images/${props.ID}`}
src={`${base}/images/${props.ID}?token=${accessToken}`}
/>
</A>
<button