Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/frontend/src/utils/discourse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ export const getDiscourseTopicUrl = (url: string): string => {
return url.replace(discourseBaseUrl, "").replace(/^\//, "");
};

export const validateDiscourseTopicExists = async (topicName: string, delay: number = 500): Promise<boolean> => {
export const validateDiscourseTopicExists = async (topic: string, delay: number = 500): Promise<boolean> => {
return new Promise(resolve => {
if (debounceTimer) {
clearTimeout(debounceTimer);
}

debounceTimer = window.setTimeout(async () => {
try {
if (!topicName.trim()) {
if (!topic.trim()) {
resolve(false);
return;
}

const url = `${discourseBaseUrl}${encodeURIComponent(topicName)}`;
const url = getFullDiscourseUrl(topic);

Comment thread
victhorbi marked this conversation as resolved.
const response = await fetch(url, {
method: "HEAD",
Expand Down