Remove config module dependency from frontend

- Delete unused useWebsockets.ts hook
- Hardcode API URLs instead of using config module:
  - useClient.ts: default '/api'
  - useAuth.ts: '/api/auth' and '/api'
  - usePasskeys.ts: '/api/auth'
  - useImageLoader.ts: '/api'
  - useFiles.ts: '/api'
  - file-types.ts: '/api'
- Remove useWebsockets export from hooks/index.ts
This commit is contained in:
2026-02-20 21:52:07 +00:00
parent ba51ee0320
commit 15ab29e23f
8 changed files with 13 additions and 127 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
import { useClient, getHeaders } from 'hooks/useClient';
import { config } from 'config';
const API_URL = '/api';
export type DirEntry = {
name: string;
@@ -79,7 +80,7 @@ export const useFiles = (root: string = 'home') => {
triggerBlobDownload(blob, isDir && !name.endsWith('.zip') ? `${name}.zip` : name);
} else {
const headers = getHeaders();
const url = `${config.API_URL}/${withRoot('/file-browser/download').replace(/^\//, '')}`;
const url = `${API_URL}/${withRoot('/file-browser/download').replace(/^\//, '')}`;
const res = await fetch(url, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
@@ -98,7 +99,7 @@ export const useFiles = (root: string = 'home') => {
formData.append('file', file, name);
}
const authHeaders = getHeaders();
const url = withRoot(`${config.API_URL}/file-browser/upload?path=${encodeURIComponent(path)}`);
const url = withRoot(`${API_URL}/file-browser/upload?path=${encodeURIComponent(path)}`);
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();