Files
sso-portal/app/api/front/getAbbrList/route.ts
zhangheng 37f10118d3 chore: initial commit of sso-mock SSO login service
Next.js + Mantine mock SSO service providing account/password, phone
verify-code, and Feishu QR login. Issues a one-time sso_code that the
external app exchanges for user info.

Includes:
- Feishu callback fix: guard against duplicate/concurrent /api/login
  submissions of the same single-use authorization code (feishuLogin
  once-guard + memoized onLoginSuccess to stop effect re-fire).
- ADAPTATION_GUIDE.md: how to switch from the in-memory code store to
  the real backend auth/index + inner_get_user_info endpoints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 18:09:30 +08:00

34 lines
928 B
TypeScript

import { NextResponse } from 'next/server'
const SHARED_API = (
process.env.NEXT_PUBLIC_SHARED_API_PATH || 'http://172.16.115.31:6610'
).replace(/\/+$/, '')
export async function GET() {
const fetchUrl = `${SHARED_API}/api/v1/basis/tenant/base/listabbr`
console.log('[sso-mock] getAbbrList:', fetchUrl)
try {
const res = await fetch(fetchUrl, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
})
if (res.status !== 200) {
return NextResponse.json(
{ code: 500, message: `获取租户信息失败 (${res.status})` },
{ status: res.status }
)
}
const data = await res.json()
return NextResponse.json(data, { status: 200 })
} catch (err: any) {
console.error('[sso-mock] getAbbrList error:', err.message)
return NextResponse.json(
{ message: err?.message || '获取租户信息失败' },
{ status: 500 }
)
}
}