Skip to content

Commit

Permalink
go home when no history state present
Browse files Browse the repository at this point in the history
  • Loading branch information
itswadesh committed Apr 22, 2023
1 parent 955cfca commit 36754e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/routes/(product)/product/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,15 @@ if (data.product?.size?.name === 'One Size') {
selectedSize = 'One Size'
}
let Konvas
function handlePopstate(event) {
if (!history.state) {
goto('/')
}
}
onMount(async () => {
window.addEventListener('popstate', handlePopstate)
try {
screenWidth = screen.width
Expand Down

1 comment on commit 36754e1

@vercel
Copy link

@vercel vercel bot commented on 36754e1 Apr 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.