mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 20:48:27 +00:00
Merge pull request #405 from tidalcycles/fix-share-on-subpath
fix: share url on subpath
This commit is contained in:
commit
d87beb37b8
@ -222,10 +222,10 @@ export function Repl({ embedded = false }) {
|
|||||||
}
|
}
|
||||||
// generate uuid in the browser
|
// generate uuid in the browser
|
||||||
const hash = nanoid(12);
|
const hash = nanoid(12);
|
||||||
|
const shareUrl = window.location.origin + window.location.pathname + '?' + hash;
|
||||||
const { data, error } = await supabase.from('code').insert([{ code: codeToShare, hash }]);
|
const { data, error } = await supabase.from('code').insert([{ code: codeToShare, hash }]);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
setLastShared(activeCode || code);
|
setLastShared(activeCode || code);
|
||||||
const shareUrl = window.location.origin + '?' + hash;
|
|
||||||
// copy shareUrl to clipboard
|
// copy shareUrl to clipboard
|
||||||
await navigator.clipboard.writeText(shareUrl);
|
await navigator.clipboard.writeText(shareUrl);
|
||||||
const message = `Link copied to clipboard: ${shareUrl}`;
|
const message = `Link copied to clipboard: ${shareUrl}`;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user