From 61d5e1df5341ff40b8cb0695cc9ffa1db4b3150f Mon Sep 17 00:00:00 2001 From: Mehdi Torabi <46302001+mehdi-torabiv@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:25:35 +0300 Subject: [PATCH] fix (#344) * fix * rename --- .../communityPlatforms/TcDiscourse.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/communitySettings/communityPlatforms/TcDiscourse.tsx b/src/components/communitySettings/communityPlatforms/TcDiscourse.tsx index a408dde7..e4f434a6 100644 --- a/src/components/communitySettings/communityPlatforms/TcDiscourse.tsx +++ b/src/components/communitySettings/communityPlatforms/TcDiscourse.tsx @@ -57,11 +57,17 @@ function TcDiscourse({ const handleCreateNewPlatform = async () => { try { setIsCreatePlatformLoading(true); + + const transformedUrl = url + .replace(/\/+$/, '') + .replaceAll('https://', '') + .replaceAll('http://', ''); + const data = await createNewPlatform({ community: community?.id, name: 'discourse', metadata: { - id: url.replaceAll('https://', '').replaceAll('http://', ''), + id: transformedUrl, period: new Date( new Date().setDate(new Date().getDate() - 90) ).toISOString(), @@ -264,7 +270,7 @@ function TcDiscourse({ />