Split stuff

This commit is contained in:
Philipp Heckel 2022-02-18 14:41:01 -05:00
parent 31e7aa24bc
commit 1fe598a966
5 changed files with 76 additions and 55 deletions

6
web/src/utils.js Normal file
View file

@ -0,0 +1,6 @@
export const topicUrl = (baseUrl, topic) => `${baseUrl}/${topic}`;
export const topicUrlWs = (baseUrl, topic) => `${topicUrl(baseUrl, topic)}/ws`
.replaceAll("https://", "wss://")
.replaceAll("http://", "ws://");
export const shortUrl = (url) => url.replaceAll(/https?:\/\//g, "");
export const shortTopicUrl = (baseUrl, topic) => shortUrl(topicUrl(baseUrl, topic));