~bigbes/lethe

ref: d2a77459be9c2a2a61326e3bce1e64b749bda522 lethe/web/src/routes/login.tsx -rw-r--r-- 1.0 KiB
d2a77459 — Eugene Blikh fix: store full opencode tool output and display it in session view 23 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { useEffect } from 'react'
import { createFileRoute } from '@tanstack/react-router'
import { useAuth } from '../lib/authContext'

export const Route = createFileRoute('/login')({
  validateSearch: (s: Record<string, unknown>) => ({
    return_to: typeof s['return_to'] === 'string' ? s['return_to'] : '/',
  }),
  component: LoginRoute,
})

function LoginRoute(): React.JSX.Element {
  const { signIn } = useAuth()
  const { return_to } = Route.useSearch()

  useEffect(() => {
    signIn(return_to)
  // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []) // mount-only: trigger redirect once

  return (
    <div
      className="body body-pad"
      style={{ display: 'flex', justifyContent: 'center', paddingTop: 60 }}
    >
      <div className="card" style={{ padding: '24px 32px', textAlign: 'center' }}>
        <div className="uppercase-mono" style={{ marginBottom: 8 }}>redirecting</div>
        <div className="muted">Taking you to the sign-in page.</div>
      </div>
    </div>
  )
}