Skip to content

Commit

Permalink
use named groups
Browse files Browse the repository at this point in the history
  • Loading branch information
mariofriz committed Mar 19, 2023
1 parent 3ea1963 commit a9a5b55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ const routes: RouteConfig[] = [{
if (from.fullPath === '/' && to.hash.startsWith('#_request/')) {
// old safe links are in this format: /#_request/NQ208P9L3YMDGQYT1TAA8D0GMC125HBQ1Q8A/100_
// new wallet links are in this format: /nimiq:NQ208P9L3YMDGQYT1TAA8D0GMC125HBQ1Q8A?amount=100
const results = to.hash.match(/^#_request\/([A-Z0-9]+)\/?(\d+)?_$/);
const address = results?.[1];
const amount = results?.[2] ? `?amount=${results?.[2]}` : '';
const results = to.hash.match(/^#_request\/(?<address>[A-Z0-9]+)\/?(?<amount>\d+)?_$/);
const address = results?.groups?.address;
const amount = results?.groups?.amount ? `?amount=${results.groups.amount}` : '';
next({
name: 'send-via-uri',
hash: `nimiq:${address}${amount}`,
Expand Down

0 comments on commit a9a5b55

Please sign in to comment.