fix backend
This commit is contained in:
parent
9f91514f78
commit
7926efa222
3 changed files with 13 additions and 9 deletions
|
@ -66,7 +66,7 @@ export default component$(({ file }: FileProps) => {
|
|||
<div class="rounded-xl bg-neutral-900 flex flex-col group overflow-hidden hover:bg-neutral-800 transition-all duration-200">
|
||||
<div class="relative">
|
||||
<a
|
||||
href={`/api/${file.Owner}/${file.Name}`}
|
||||
href={`/api/${file.ID}`}
|
||||
target="_blank"
|
||||
class="flex w-full h-60 overflow-clip"
|
||||
>
|
||||
|
@ -78,7 +78,7 @@ export default component$(({ file }: FileProps) => {
|
|||
<div class="absolute bottom-2 right-2 gap-2 z-10 group-hover:flex hidden duration-200 transition-all">
|
||||
<a
|
||||
class="bg-neutral-600/40 backdrop-blur-lg hover:bg-neutral-600/75 transition-all duration-200 text-white p-2 rounded-lg active:scale-95"
|
||||
href={`/api/${file.Owner}/${file.Name}`}
|
||||
href={`/api/${file.ID}`}
|
||||
target="_blank"
|
||||
>
|
||||
<SolarDownloadMinimalisticBold class="w-6 h-6"/>
|
||||
|
@ -148,7 +148,7 @@ const FilePreview = component$(({ file }: FileProps) => {
|
|||
<img
|
||||
width={400}
|
||||
height={300}
|
||||
src={`/api/${file.Owner}/${file.Name}`}
|
||||
src={`/api/${file.ID}`}
|
||||
alt={file.Name}
|
||||
class="w-full h-60 object-cover flex-grow"
|
||||
/>
|
||||
|
@ -160,7 +160,7 @@ const FilePreview = component$(({ file }: FileProps) => {
|
|||
<video
|
||||
width={400}
|
||||
height={300}
|
||||
src={`/api/${file.Owner}/${file.Name}`}
|
||||
src={`/api/${file.ID}`}
|
||||
class="w-full h-60 object-cover flex-grow"
|
||||
controls
|
||||
autoplay
|
||||
|
@ -180,7 +180,7 @@ const FilePreview = component$(({ file }: FileProps) => {
|
|||
<audio
|
||||
controls
|
||||
class="w-full h-12"
|
||||
src={`/api/${file.Owner}/${file.Name}`}
|
||||
src={`/api/${file.ID}`}
|
||||
>
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
|
|
|
@ -7,14 +7,16 @@ export const client = ky.create({
|
|||
});
|
||||
// TODO: make wrapper for apiclient fr
|
||||
export const api = {
|
||||
file: async (file_id: string) => await client.get(file_id),
|
||||
list: async () => await client.get('list').json<StereoFile[]>(),
|
||||
file: async (uid: string) => await client.get<Blob>(uid),
|
||||
list: async () => {
|
||||
return await client.get('list').json<StereoFile[]>();
|
||||
},
|
||||
upload: async (file: File) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return await client.post('upload', { body: formData });
|
||||
},
|
||||
delete: async (uid: string, file: string) => {
|
||||
return await client.delete(`${uid}/${file}`).json();
|
||||
return await client.delete(uid).json();
|
||||
},
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
export type StereoFile = {
|
||||
ID: string;
|
||||
Name: string;
|
||||
Owner: string;
|
||||
CreatedAt: string;
|
||||
Size: number;
|
||||
CreatedAt: string;
|
||||
Mime: string;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue