Files
woodpecker/web/src/compositions/useApiClient.ts
qwerty287 67b7de5cc2 Fix UI and backend paths with subpath (#1799)
I'm not sure if this is an ideal fix for this, but it seems to work for
me. If you have another idea just let me know.

Closes #1798 
Closes #1773
2023-08-07 16:05:18 +02:00

19 lines
406 B
TypeScript

import WoodpeckerClient from '~/lib/api';
import useConfig from './useConfig';
let apiClient: WoodpeckerClient | undefined;
export default (): WoodpeckerClient => {
if (!apiClient) {
const config = useConfig();
const server = config.rootPath;
const token = null;
const csrf = config.csrf || null;
apiClient = new WoodpeckerClient(server, token, csrf);
}
return apiClient;
};