We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ce21d3 commit 3a9a09fCopy full SHA for 3a9a09f
1 file changed
frontend/src/utils/note.utils.ts
@@ -1,6 +1,9 @@
1
import { BACKEND_URL } from "../config/backendConfig";
2
3
+const isProduction = import.meta.env.PROD;
4
+const ASSETS_PATH = isProduction ? 'notes-app/assets' : 'assets';
5
+
6
export function getFileURL(userId: string, fileType: 'audio' | 'image', fileName: string) {
- const url = new URL(`assets/${fileType === 'image' ? 'images' : 'audio'}/${userId}/${fileName}`, BACKEND_URL)
7
+ const url = new URL(`${ASSETS_PATH}/${fileType === 'image' ? 'images' : 'audio'}/${userId}/${fileName}`, BACKEND_URL)
8
return url.toString();
9
}
0 commit comments