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="rounded-xl bg-neutral-900 flex flex-col group overflow-hidden hover:bg-neutral-800 transition-all duration-200">
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<a
|
<a
|
||||||
href={`/api/${file.Owner}/${file.Name}`}
|
href={`/api/${file.ID}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="flex w-full h-60 overflow-clip"
|
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">
|
<div class="absolute bottom-2 right-2 gap-2 z-10 group-hover:flex hidden duration-200 transition-all">
|
||||||
<a
|
<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"
|
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"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<SolarDownloadMinimalisticBold class="w-6 h-6"/>
|
<SolarDownloadMinimalisticBold class="w-6 h-6"/>
|
||||||
|
@ -148,7 +148,7 @@ const FilePreview = component$(({ file }: FileProps) => {
|
||||||
<img
|
<img
|
||||||
width={400}
|
width={400}
|
||||||
height={300}
|
height={300}
|
||||||
src={`/api/${file.Owner}/${file.Name}`}
|
src={`/api/${file.ID}`}
|
||||||
alt={file.Name}
|
alt={file.Name}
|
||||||
class="w-full h-60 object-cover flex-grow"
|
class="w-full h-60 object-cover flex-grow"
|
||||||
/>
|
/>
|
||||||
|
@ -160,7 +160,7 @@ const FilePreview = component$(({ file }: FileProps) => {
|
||||||
<video
|
<video
|
||||||
width={400}
|
width={400}
|
||||||
height={300}
|
height={300}
|
||||||
src={`/api/${file.Owner}/${file.Name}`}
|
src={`/api/${file.ID}`}
|
||||||
class="w-full h-60 object-cover flex-grow"
|
class="w-full h-60 object-cover flex-grow"
|
||||||
controls
|
controls
|
||||||
autoplay
|
autoplay
|
||||||
|
@ -180,7 +180,7 @@ const FilePreview = component$(({ file }: FileProps) => {
|
||||||
<audio
|
<audio
|
||||||
controls
|
controls
|
||||||
class="w-full h-12"
|
class="w-full h-12"
|
||||||
src={`/api/${file.Owner}/${file.Name}`}
|
src={`/api/${file.ID}`}
|
||||||
>
|
>
|
||||||
Your browser does not support the audio element.
|
Your browser does not support the audio element.
|
||||||
</audio>
|
</audio>
|
||||||
|
|
|
@ -7,14 +7,16 @@ export const client = ky.create({
|
||||||
});
|
});
|
||||||
// TODO: make wrapper for apiclient fr
|
// TODO: make wrapper for apiclient fr
|
||||||
export const api = {
|
export const api = {
|
||||||
file: async (file_id: string) => await client.get(file_id),
|
file: async (uid: string) => await client.get<Blob>(uid),
|
||||||
list: async () => await client.get('list').json<StereoFile[]>(),
|
list: async () => {
|
||||||
|
return await client.get('list').json<StereoFile[]>();
|
||||||
|
},
|
||||||
upload: async (file: File) => {
|
upload: async (file: File) => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
return await client.post('upload', { body: formData });
|
return await client.post('upload', { body: formData });
|
||||||
},
|
},
|
||||||
delete: async (uid: string, file: string) => {
|
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 = {
|
export type StereoFile = {
|
||||||
|
ID: string;
|
||||||
Name: string;
|
Name: string;
|
||||||
Owner: string;
|
Owner: string;
|
||||||
CreatedAt: string;
|
|
||||||
Size: number;
|
Size: number;
|
||||||
|
CreatedAt: string;
|
||||||
|
Mime: string;
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue