Fix: preserve API key on login (don't overwrite with placeholder)
This commit is contained in:
@@ -217,8 +217,7 @@ const handleLogin = async () => {
|
|||||||
if (data.success) {
|
if (data.success) {
|
||||||
localStorage.setItem('momentry_user', JSON.stringify(data.user))
|
localStorage.setItem('momentry_user', JSON.stringify(data.user))
|
||||||
localStorage.setItem('momentry_api_key', data.api_key)
|
localStorage.setItem('momentry_api_key', data.api_key)
|
||||||
const config = getCurrentConfig()
|
// Keep the existing api_key from config/env (login response key may be a placeholder)
|
||||||
saveConfig({ ...config, api_key: data.api_key })
|
|
||||||
const redirect = (route.query.redirect as string) || '/home'
|
const redirect = (route.query.redirect as string) || '/home'
|
||||||
router.push(redirect)
|
router.push(redirect)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user