Skip to content

Commit

Permalink
Merge branch 'main' into feat/robots_settings_pwa
Browse files Browse the repository at this point in the history
  • Loading branch information
ivladu-plenty authored Nov 29, 2024
2 parents 25ff69b + c7d4c19 commit 9b2db97
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apps/web/middleware/guest-guard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default defineNuxtRouteMiddleware(() => {
const { isGuest, isAuthorized } = useCustomer();
const localePath = useLocalePath();

if (isGuest.value || (!isGuest.value && !isAuthorized.value)) return;
return navigateTo(localePath(paths.home));
});
5 changes: 4 additions & 1 deletion apps/web/pages/guest/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
</template>

<script setup lang="ts">
definePageMeta({ pageType: 'static' });
definePageMeta({
pageType: 'static',
middleware: ['guest-guard'],
});
</script>
1 change: 1 addition & 0 deletions apps/web/pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script setup lang="ts">
definePageMeta({
layout: false,
middleware: ['guest-guard'],
});
const router = useRouter();
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/changelog_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### New

- Added a Guest guard middleware to restrict access to pages for authenticated users.
- Added the ability to filter products by rating on category pages.
- Added PWA cookie hash to sdk client
- Added progress loading indicator animation when navigating between pages.
Expand Down

0 comments on commit 9b2db97

Please sign in to comment.