refactor: un-hardcode file urls

This commit is contained in:
Zoe
2026-05-12 10:28:33 -05:00
parent 9550d44220
commit 47009b1f0a
11 changed files with 2790 additions and 15 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
import { attempt } from "~~/types/result";
import * as schema from '~~/drizzle/schema';
import { resolveFileUrl } from '~~/utils/url';
export type ResourceFile = typeof schema.files.$inferSelect;
@@ -118,12 +119,12 @@ export const useResources = async () => {
};
const copyLink = async (file: ResourceFile) => {
const url = file.url;
const url = resolveFileUrl(file.url);
await navigator.clipboard.writeText(url);
};
const downloadFile = (file: ResourceFile) => {
const url = file.url;
const url = resolveFileUrl(file.url);
const a = document.createElement('a');
a.href = url;
a.download = file.name;