chore: fix resource url

This commit is contained in:
Steven 2024-02-05 19:35:23 +08:00
parent 397a7f00ef
commit e35225ff24

View File

@ -1,11 +1,11 @@
import { Resource } from "@/types/proto/api/v2/resource_service";
export const getResourceUrl = (resource: Resource, withOrigin = true) => {
export const getResourceUrl = (resource: Resource) => {
if (resource.externalLink) {
return resource.externalLink;
}
return `${withOrigin ? window.location.origin : ""}/o/r/${resource.name}`;
return `${import.meta.env.VITE_API_BASE_URL || window.location.origin}/o/r/${resource.name}`;
};
export const getResourceType = (resource: Resource) => {