think/packages/client/src/helpers/url.ts

17 lines
499 B
TypeScript
Raw Normal View History

2022-02-20 11:51:55 +00:00
export const buildUrl = (url) => {
2022-03-12 03:27:56 +00:00
if (typeof window === 'undefined') return url;
2022-02-20 11:51:55 +00:00
return `${window.location.origin}${url}`;
};
2022-03-11 05:57:55 +00:00
export const getWikiShareURL = (wikiId) => {
2022-05-24 09:33:30 +00:00
const url = '/share/wiki/' + wikiId;
if (typeof window === 'undefined') return url;
return window.location.origin + url;
2022-03-11 05:57:55 +00:00
};
export const getDocumentShareURL = (documentId) => {
2022-05-24 09:33:30 +00:00
const url = '/share/document/' + documentId;
if (typeof window === 'undefined') return url;
return window.location.origin + url;
2022-03-11 05:57:55 +00:00
};