Skip to content

Commit dceee19

Browse files
committed
refactor: réécriture goToNewChatbot
1 parent bd74dc1 commit dceee19

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

app/js/utils/urls.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,16 @@ export function getParamsFromURL(
115115
}
116116

117117
// Pour ouvrir un nouveau chatbot
118-
export function goToNewChatbot(urlNewChatbot) {
118+
export function goToNewChatbot(
119+
urlNewChatbot,
120+
URLbaseChatbot = window.location.origin,
121+
) {
119122
if (urlNewChatbot && urlNewChatbot.indexOf(".") > -1) {
120-
const fullUrl = window.location.origin + `/#${urlNewChatbot}`;
123+
URLbaseChatbot =
124+
!URLbaseChatbot || URLbaseChatbot == "null" ? "" : URLbaseChatbot;
125+
const fullUrl = URLbaseChatbot + `/#${urlNewChatbot}`;
121126
window.open(fullUrl, "_blank");
122127
} else {
123-
alert("Veuillez entrer une URL valide.");
128+
window.alert("Veuillez entrer une URL valide.");
124129
}
125130
}

0 commit comments

Comments
 (0)