fix auth modal, lang picking
This commit is contained in:
parent
3ae82ecb59
commit
f4c974d1e1
|
@ -135,9 +135,11 @@ export default (props: { code?: string; mode?: string }) => {
|
|||
// hiding itself if finished
|
||||
console.log('[auth] success, hiding modal')
|
||||
hideModal()
|
||||
} else if (session().error) {
|
||||
} else if (session()?.error) {
|
||||
console.log('[auth] failure, showing error')
|
||||
setError(t(statuses[session().error || 'unknown error']))
|
||||
} else {
|
||||
console.log('[auth] session', session())
|
||||
}
|
||||
}, [session()])
|
||||
return (
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// FIXME: breaks on vercel, research
|
||||
// import 'solid-devtools'
|
||||
|
||||
import { Component, createMemo, lazy } from 'solid-js'
|
||||
import { setLocale } from '../stores/ui'
|
||||
import { Component, createEffect, createMemo, lazy } from 'solid-js'
|
||||
import { Routes, useRouter } from '../stores/router'
|
||||
import { Dynamic } from 'solid-js/web'
|
||||
import { Dynamic, isServer } from 'solid-js/web'
|
||||
import { getLogger } from '../utils/logger'
|
||||
|
||||
import type { PageProps } from './types'
|
||||
|
@ -76,6 +77,14 @@ export const Root = (props: PageProps) => {
|
|||
|
||||
return result
|
||||
})
|
||||
// TODO: move MainLayout here
|
||||
|
||||
if (!isServer) {
|
||||
createEffect(() => {
|
||||
const lang = new URLSearchParams(window.location.search).get('lang') || 'ru'
|
||||
console.log('[root] client locale is', lang)
|
||||
setLocale(lang)
|
||||
}, [window.location.search])
|
||||
}
|
||||
|
||||
return <Dynamic component={pageComponent()} {...props} />
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
---
|
||||
import { setLocale } from '../stores/ui';
|
||||
import '../styles/app.scss'
|
||||
import { t } from '../utils/intl'
|
||||
|
||||
const lang = Astro.url.searchParams.get('lang')
|
||||
const lang = Astro.url.searchParams.get('lang') || 'ru'
|
||||
console.log('[layout] server locale is', lang)
|
||||
setLocale(lang)
|
||||
|
||||
---
|
||||
<html lang={lang || 'ru'}>
|
||||
<head>
|
||||
|
|
Loading…
Reference in New Issue
Block a user