Add Mollie checkout flow, billing UI, and payment UX polish #71

Merged
uz1mani merged 73 commits from staging into main 2026-03-28 10:28:03 +00:00
16 changed files with 939 additions and 115 deletions
Showing only changes of commit 5cff767e32 - Show all commits

View File

@@ -81,12 +81,10 @@ function LayoutInner({ children }: { children: React.ReactNode }) {
setIsSwitchingOrg(true)
const { access_token } = await switchContext(orgId)
await setSessionAction(access_token)
router.refresh()
// Allow time for server components to re-fetch with new auth
setTimeout(() => {
setIsSwitchingOrg(false)
router.push('/')
}, 600)
// Refresh auth context (re-fetches /auth/user/me with new JWT, updates org_id + SWR cache)
await auth.refresh()
router.push('/')
setTimeout(() => setIsSwitchingOrg(false), 300)
} catch (err) {
setIsSwitchingOrg(false)
logger.error('Failed to switch organization', err)

View File

@@ -112,14 +112,9 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
try {
const userData = await apiRequest<User>('/auth/user/me')
setUser(prev => {
const merged = {
...userData,
org_id: prev?.org_id,
role: prev?.role
}
localStorage.setItem('user', JSON.stringify(merged))
return merged
setUser(() => {
localStorage.setItem('user', JSON.stringify(userData))
return userData
})
} catch (e) {
logger.error('Failed to refresh user data', e)