feat: [barobill] 로그인 정보 등록/수정 조건부 표시
- 바로빌 ID 등록 시 아이디 표시 + 수정 버튼 - 미등록 시 기존 등록 버튼 유지 - IntegrationStatus에 member 정보 추가
This commit is contained in:
@@ -66,9 +66,15 @@ export async function getBankServiceUrl(
|
|||||||
export async function getIntegrationStatus(): Promise<ActionResult<IntegrationStatus>> {
|
export async function getIntegrationStatus(): Promise<ActionResult<IntegrationStatus>> {
|
||||||
return executeServerAction({
|
return executeServerAction({
|
||||||
url: buildApiUrl('/api/v1/barobill/status'),
|
url: buildApiUrl('/api/v1/barobill/status'),
|
||||||
transform: (data: { bank_service_count?: number; account_link_count?: number }) => ({
|
transform: (data: { bank_service_count?: number; account_link_count?: number; member?: { barobill_id?: string; biz_no?: string; status?: string; server_mode?: string } }) => ({
|
||||||
bankServiceCount: data.bank_service_count ?? 0,
|
bankServiceCount: data.bank_service_count ?? 0,
|
||||||
accountLinkCount: data.account_link_count ?? 0,
|
accountLinkCount: data.account_link_count ?? 0,
|
||||||
|
member: data.member ? {
|
||||||
|
barobillId: data.member.barobill_id ?? '',
|
||||||
|
bizNo: data.member.biz_no ?? '',
|
||||||
|
status: data.member.status ?? '',
|
||||||
|
serverMode: data.member.server_mode ?? '',
|
||||||
|
} : undefined,
|
||||||
}),
|
}),
|
||||||
errorMessage: '연동 현황 조회에 실패했습니다.',
|
errorMessage: '연동 현황 조회에 실패했습니다.',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useState, useEffect, useCallback } from 'react';
|
import { useState, useEffect, useCallback } from 'react';
|
||||||
import { PageLayout } from '@/components/organisms/PageLayout';
|
import { PageLayout } from '@/components/organisms/PageLayout';
|
||||||
import { PageHeader } from '@/components/organisms/PageHeader';
|
import { PageHeader } from '@/components/organisms/PageHeader';
|
||||||
import { Link2, Loader2 } from 'lucide-react';
|
import { Link2, Loader2, Pencil, Check } from 'lucide-react';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Card, CardContent } from '@/components/ui/card';
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
@@ -64,6 +64,8 @@ export function BarobillIntegration() {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const hasLogin = !!status?.member?.barobillId;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageLayout>
|
<PageLayout>
|
||||||
<PageHeader
|
<PageHeader
|
||||||
@@ -77,20 +79,49 @@ export function BarobillIntegration() {
|
|||||||
<section>
|
<section>
|
||||||
<h2 className="text-lg font-semibold mb-3">바로빌 연동</h2>
|
<h2 className="text-lg font-semibold mb-3">바로빌 연동</h2>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
{/* 바로빌 로그인 정보 등록 */}
|
{/* 바로빌 로그인 정보 */}
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent className="p-5">
|
<CardContent className="p-5">
|
||||||
<h3 className="font-semibold mb-2">바로빌 회원이신가요?</h3>
|
{hasLogin ? (
|
||||||
<p className="text-sm text-muted-foreground mb-4">
|
<>
|
||||||
바로빌 로그인 발급 정보 등록
|
<h3 className="font-semibold mb-3">바로빌 로그인 정보</h3>
|
||||||
</p>
|
<div className="space-y-2 mb-4">
|
||||||
<Button
|
<div className="flex items-center gap-2 text-sm">
|
||||||
variant="destructive"
|
<span className="text-muted-foreground w-16 shrink-0">아이디</span>
|
||||||
className="w-full"
|
<span className="font-medium">{status?.member?.barobillId}</span>
|
||||||
onClick={() => setLoginOpen(true)}
|
</div>
|
||||||
>
|
<div className="flex items-center gap-2 text-sm">
|
||||||
바로빌 로그인 정보 등록
|
<span className="text-muted-foreground w-16 shrink-0">비밀번호</span>
|
||||||
</Button>
|
<span className="font-medium">●●●●●●●●</span>
|
||||||
|
<Badge variant="secondary" className="text-xs">
|
||||||
|
<Check className="h-3 w-3 mr-1" />설정됨
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
className="w-full"
|
||||||
|
onClick={() => setLoginOpen(true)}
|
||||||
|
>
|
||||||
|
<Pencil className="h-4 w-4 mr-2" />
|
||||||
|
로그인 정보 수정
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<h3 className="font-semibold mb-2">바로빌 회원이신가요?</h3>
|
||||||
|
<p className="text-sm text-muted-foreground mb-4">
|
||||||
|
바로빌 로그인 발급 정보 등록
|
||||||
|
</p>
|
||||||
|
<Button
|
||||||
|
variant="destructive"
|
||||||
|
className="w-full"
|
||||||
|
onClick={() => setLoginOpen(true)}
|
||||||
|
>
|
||||||
|
바로빌 로그인 정보 등록
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|||||||
@@ -54,4 +54,10 @@ export const ACCOUNT_TYPE_OPTIONS = [
|
|||||||
export interface IntegrationStatus {
|
export interface IntegrationStatus {
|
||||||
bankServiceCount: number;
|
bankServiceCount: number;
|
||||||
accountLinkCount: number;
|
accountLinkCount: number;
|
||||||
|
member?: {
|
||||||
|
barobillId: string;
|
||||||
|
bizNo: string;
|
||||||
|
status: string;
|
||||||
|
serverMode: string;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user