fix: share url on subpath

fixes https://github.com/tidalcycles/strudel/issues/389
This commit is contained in:
Felix Roos 2023-02-02 21:43:24 +01:00
parent 478a7e95ea
commit dcdb383960

View File

@ -222,10 +222,10 @@ export function Repl({ embedded = false }) {
}
// generate uuid in the browser
const hash = nanoid(12);
const shareUrl = window.location.origin + window.location.pathname + '?' + hash;
const { data, error } = await supabase.from('code').insert([{ code: codeToShare, hash }]);
if (!error) {
setLastShared(activeCode || code);
const shareUrl = window.location.origin + '?' + hash;
// copy shareUrl to clipboard
await navigator.clipboard.writeText(shareUrl);
const message = `Link copied to clipboard: ${shareUrl}`;