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>> {
|
||||
return executeServerAction({
|
||||
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,
|
||||
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: '연동 현황 조회에 실패했습니다.',
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { PageLayout } from '@/components/organisms/PageLayout';
|
||||
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 { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -64,6 +64,8 @@ export function BarobillIntegration() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const hasLogin = !!status?.member?.barobillId;
|
||||
|
||||
return (
|
||||
<PageLayout>
|
||||
<PageHeader
|
||||
@@ -77,20 +79,49 @@ export function BarobillIntegration() {
|
||||
<section>
|
||||
<h2 className="text-lg font-semibold mb-3">바로빌 연동</h2>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
{/* 바로빌 로그인 정보 등록 */}
|
||||
{/* 바로빌 로그인 정보 */}
|
||||
<Card>
|
||||
<CardContent className="p-5">
|
||||
<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>
|
||||
{hasLogin ? (
|
||||
<>
|
||||
<h3 className="font-semibold mb-3">바로빌 로그인 정보</h3>
|
||||
<div className="space-y-2 mb-4">
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<span className="text-muted-foreground w-16 shrink-0">아이디</span>
|
||||
<span className="font-medium">{status?.member?.barobillId}</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<span className="text-muted-foreground w-16 shrink-0">비밀번호</span>
|
||||
<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>
|
||||
</Card>
|
||||
|
||||
|
||||
@@ -54,4 +54,10 @@ export const ACCOUNT_TYPE_OPTIONS = [
|
||||
export interface IntegrationStatus {
|
||||
bankServiceCount: number;
|
||||
accountLinkCount: number;
|
||||
member?: {
|
||||
barobillId: string;
|
||||
bizNo: string;
|
||||
status: string;
|
||||
serverMode: string;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user