fix: url built with buildUrl

This commit is contained in:
Yassine Sallemi 2024-09-20 16:42:31 +01:00
parent cdf8461312
commit 36cd3179d8

View File

@ -16,6 +16,7 @@ import { ReactNode } from "react";
import { ROUTES } from "@/services/api.class"; import { ROUTES } from "@/services/api.class";
import { EntityType } from "@/services/types"; import { EntityType } from "@/services/types";
import { IMessage, IMessageFull } from "@/types/message.types"; import { IMessage, IMessageFull } from "@/types/message.types";
import { buildURL } from "@/utils/URL";
import { AttachmentViewer } from "../components/AttachmentViewer"; import { AttachmentViewer } from "../components/AttachmentViewer";
import { Carousel } from "../components/Carousel"; import { Carousel } from "../components/Carousel";
@ -134,10 +135,7 @@ export function getAvatarSrc(
entity: EntityType.USER | EntityType.SUBSCRIBER, entity: EntityType.USER | EntityType.SUBSCRIBER,
id?: string, id?: string,
) { ) {
//remove trailing slash return buildURL(apiUrl, `${ROUTES[entity]}/${id || "bot"}/profile_pic`);
return `${String(apiUrl).replace(/\/$/, "")}${ROUTES[entity]}/${
id || "bot"
}/profile_pic`;
} }
export function getMessagePosition( export function getMessagePosition(