mirror of
https://github.com/makeplane/plane.git
synced 2026-07-11 21:10:13 +02:00
* fix: generate file url function * chore: remove unused imports * chore: replace indexOf logix with startsWith
15 lines
417 B
TypeScript
15 lines
417 B
TypeScript
// helpers
|
|
import { API_BASE_URL } from "@/helpers/common.helper";
|
|
|
|
/**
|
|
* @description combine the file path with the base URL
|
|
* @param {string} path
|
|
* @returns {string} final URL with the base URL
|
|
*/
|
|
export const getFileURL = (path: string): string | undefined => {
|
|
if (!path) return undefined;
|
|
const isValidURL = path.startsWith("http");
|
|
if (isValidURL) return path;
|
|
return `${API_BASE_URL}${path}`;
|
|
};
|