]> zoso.dev Git - nemo-wallet.git/commitdiff
Explicitly define character set. Improve error handling for page navigation.
authorChris Duncan <chris@zoso.dev>
Sun, 20 Oct 2024 06:09:34 +0000 (23:09 -0700)
committerChris Duncan <chris@zoso.dev>
Sun, 20 Oct 2024 06:09:34 +0000 (23:09 -0700)
app/pages/nemo-wallet.html

index dafe433b7ab42a6ec5ec29b502a7e409595d39a2..de3ceedf5211b56dc33424e5fb7731e1fa14d209 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 
 <head>
+       <meta charset="utf-8" />
        <meta lang="en" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <script>
                        console.log('loaded libnemo')
                }
                async function loadUx () {
-                       if (location.hash) {
-                               const page = document.querySelector(location.hash)
-                               page.classList.add('show')
-                       } else {
-                               location += '#transact'
+                       try {
+                               document.querySelector(location.hash).classList.add('show')
+                       } catch (err) {
+                               location.hash = '#transact'
                        }
                }
                function switchPage (evt) {
                        const oldHash = new URL(evt.oldURL)?.hash
                        const newHash = new URL(evt.newURL)?.hash
                        if (oldHash) {
-                               document.querySelector(oldHash).classList.remove('show')
+                               document.querySelector(oldHash)?.classList.remove('show')
                        }
+                       try {
                        if (newHash) {
                                document.querySelector(newHash).classList.add('show')
+                               }
+                       } catch (err) {
+                               notify.warn(`Page not found`)
                        }
                }
                function getWalletClass (algorithm) {