Enhance checkout flow with new components and validation
- Added AddressForm and CheckoutForm components for user input during checkout. - Implemented validation using Zod and VeeValidate for billing address fields. - Created OrderSummary and MockPayPalButton components for order confirmation and payment simulation. - Updated CartSheet and CartSidebar to navigate to the new checkout page at '/kasse'. - Introduced new API endpoints for validating checkout data and creating orders. - Enhanced user experience with responsive design and error handling. These changes complete the checkout functionality, allowing users to enter billing information, simulate payment, and confirm orders.
This commit is contained in:
28
app/middleware/auth.ts
Normal file
28
app/middleware/auth.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
// middleware/auth.ts
|
||||
|
||||
/**
|
||||
* Authentication middleware
|
||||
*
|
||||
* Protects routes from unauthenticated access
|
||||
*
|
||||
* Usage in pages:
|
||||
*
|
||||
* definePageMeta({
|
||||
* middleware: 'auth'
|
||||
* })
|
||||
*/
|
||||
|
||||
export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
const { loggedIn } = useUserSession()
|
||||
|
||||
// Not logged in - redirect to auth page
|
||||
if (!loggedIn.value) {
|
||||
// Store intended destination for post-login redirect
|
||||
useCookie('redirect_after_login', {
|
||||
maxAge: 600, // 10 minutes
|
||||
path: '/',
|
||||
}).value = to.fullPath
|
||||
|
||||
return navigateTo('/auth')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user