Skip to content

Commit

Permalink
feat: address shortcut page
Browse files Browse the repository at this point in the history
  • Loading branch information
toniengelhardt committed Jan 20, 2023
1 parent 66b4a00 commit c0574b1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pages/address/[address].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup lang="ts">
definePageMeta({
validate: async (route) => {
// Make sure a valid Ethereum address is passed.
return typeof route.params.address === 'string' && reEthAddress.test(route.params.address)
},
})
onBeforeMount(() => {
const route = useRoute()
const addressStore = useAddressStore()
addressStore.selectAddress(route.params.address as string)
navigateTo({ path: '/', query: route.query })
})
</script>

<template>
<div>
<!-- The page will always redirect. -->
</div>
</template>
1 change: 1 addition & 0 deletions utils/patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const reEthAddress = /^0x[a-fA-F0-9]{40}$/

0 comments on commit c0574b1

Please sign in to comment.