mirror of
https://github.com/ParkerTenBroeck/automata.git
synced 2026-06-06 21:24:06 -04:00
fixed exception for invalid share links
This commit is contained in:
parent
51d5fb5213
commit
61d7edd929
1 changed files with 16 additions and 11 deletions
|
|
@ -21,6 +21,7 @@ btn.addEventListener("click", async () => {
|
||||||
|
|
||||||
|
|
||||||
export function sharedText(): string|null {
|
export function sharedText(): string|null {
|
||||||
|
try{
|
||||||
const url = new URL(globalThis.window.location.href);
|
const url = new URL(globalThis.window.location.href);
|
||||||
let text: string | null = url.searchParams.get("share");
|
let text: string | null = url.searchParams.get("share");
|
||||||
if (text !== null) {
|
if (text !== null) {
|
||||||
|
|
@ -33,4 +34,8 @@ export function sharedText(): string|null {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
|
}catch(e){
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue