refactor: Update chat API message types from Message to CoreMessage.
This commit is contained in:
parent
b1af0cd130
commit
bd0abeef2f
@ -9,8 +9,6 @@ import { AuthLayout, AuthLayoutSocialButton } from '@components/auth/AuthLayout'
|
||||
import { useLanguage } from '@i18n/LanguageProvider'
|
||||
import { translations } from '@i18n/translations'
|
||||
|
||||
import { WeChatIcon } from '../../components/icons/WeChatIcon'
|
||||
|
||||
type LoginContentProps = {
|
||||
accountServiceBaseUrl: string
|
||||
children?: ReactNode
|
||||
@ -52,10 +50,12 @@ export default function LoginContent({ accountServiceBaseUrl, children }: LoginC
|
||||
[],
|
||||
)
|
||||
|
||||
const githubAuthUrl = process.env.NEXT_PUBLIC_GITHUB_AUTH_URL || '/api/auth/github'
|
||||
const wechatAuthUrl = process.env.NEXT_PUBLIC_WECHAT_AUTH_URL || '/api/auth/wechat'
|
||||
const loginUrl = process.env.NEXT_PUBLIC_LOGIN_URL || `${accountServiceBaseUrl}/api/auth/login`
|
||||
|
||||
const socialButtonsDisabled = false
|
||||
const githubAuthUrl = `${process.env.NEXT_PUBLIC_ACCOUNTS_SVC_URL}/api/auth/oauth/login/github`
|
||||
const googleAuthUrl = `${process.env.NEXT_PUBLIC_ACCOUNTS_SVC_URL}/api/auth/oauth/login/google`
|
||||
|
||||
const loginUrlRef = useRef(loginUrl)
|
||||
|
||||
const deriveSameOriginLoginFallback = useCallback((url: string): string | undefined => {
|
||||
@ -103,7 +103,7 @@ export default function LoginContent({ accountServiceBaseUrl, children }: LoginC
|
||||
loginUrlRef.current = loginUrl
|
||||
}, [loginUrl])
|
||||
|
||||
const socialButtonsDisabled = true
|
||||
|
||||
|
||||
const initialAlert = useMemo(() => {
|
||||
const successMessages: string[] = []
|
||||
@ -258,17 +258,17 @@ export default function LoginContent({ accountServiceBaseUrl, children }: LoginC
|
||||
{
|
||||
label: t.social.github,
|
||||
href: githubAuthUrl,
|
||||
icon: <Github className="h-5 w-5" aria-hidden />,
|
||||
icon: <Github className="h-5 w-5" aria-hidden />,
|
||||
disabled: socialButtonsDisabled,
|
||||
},
|
||||
{
|
||||
label: t.social.wechat,
|
||||
href: wechatAuthUrl,
|
||||
icon: <WeChatIcon className="h-5 w-5" aria-hidden />,
|
||||
label: "Google",
|
||||
href: googleAuthUrl,
|
||||
icon: <div className="h-5 w-5 flex items-center justify-center">G</div>, // Replace with proper icon later if available
|
||||
disabled: socialButtonsDisabled,
|
||||
},
|
||||
]
|
||||
}, [githubAuthUrl, socialButtonsDisabled, t.social.github, t.social.wechat, wechatAuthUrl])
|
||||
}, [githubAuthUrl, googleAuthUrl, socialButtonsDisabled, t.social.github])
|
||||
|
||||
const formContent = useMemo(() => {
|
||||
if (children) {
|
||||
|
||||
@ -20,7 +20,6 @@ import { AuthLayout, AuthLayoutSocialButton } from '@components/auth/AuthLayout'
|
||||
import { useLanguage } from '@i18n/LanguageProvider'
|
||||
import { translations } from '@i18n/translations'
|
||||
|
||||
import { WeChatIcon } from '../../components/icons/WeChatIcon'
|
||||
|
||||
type AlertState = { type: 'error' | 'success' | 'info'; message: string }
|
||||
|
||||
@ -37,9 +36,9 @@ export default function RegisterContent() {
|
||||
const searchParams = useSearchParams()
|
||||
const router = useRouter()
|
||||
|
||||
const githubAuthUrl = process.env.NEXT_PUBLIC_GITHUB_AUTH_URL || '/api/auth/github'
|
||||
const wechatAuthUrl = process.env.NEXT_PUBLIC_WECHAT_AUTH_URL || '/api/auth/wechat'
|
||||
const isSocialAuthVisible = false
|
||||
const isSocialAuthVisible = true
|
||||
const githubAuthUrl = `${process.env.NEXT_PUBLIC_ACCOUNTS_SVC_URL}/api/auth/oauth/login/github`
|
||||
const googleAuthUrl = `${process.env.NEXT_PUBLIC_ACCOUNTS_SVC_URL}/api/auth/oauth/login/google`
|
||||
|
||||
const socialButtons = useMemo<AuthLayoutSocialButton[]>(() => {
|
||||
if (!isSocialAuthVisible) {
|
||||
@ -53,12 +52,12 @@ export default function RegisterContent() {
|
||||
icon: <Github className="h-5 w-5" aria-hidden />,
|
||||
},
|
||||
{
|
||||
label: t.social.wechat,
|
||||
href: wechatAuthUrl,
|
||||
icon: <WeChatIcon className="h-5 w-5" aria-hidden />,
|
||||
label: "Google",
|
||||
href: googleAuthUrl,
|
||||
icon: <div className="h-5 w-5 flex items-center justify-center">G</div>,
|
||||
},
|
||||
]
|
||||
}, [githubAuthUrl, isSocialAuthVisible, t.social.github, t.social.wechat, wechatAuthUrl])
|
||||
}, [githubAuthUrl, googleAuthUrl, isSocialAuthVisible, t.social.github])
|
||||
|
||||
useEffect(() => {
|
||||
const sensitiveKeys = ['username', 'password', 'confirmPassword', 'email']
|
||||
|
||||
Loading…
Reference in New Issue
Block a user