Skip to content

Commit b81d4b2

Browse files
authored
Merge pull request #83 from JECT-Study/hotfix/74-Various-fixes
fix: render readonly consent from server data
2 parents 787e3d4 + 088f781 commit b81d4b2

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

src/app/exhibitions/[exhibitionId]/consent/page.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ function ConsentPageContent({ params }: ConsentPageProps) {
7575
const [toastMessage, setToastMessage] = useState("동의서 작성이 완료되었습니다.");
7676

7777
const mode: ConsentMode = useMemo(() => {
78-
if (readonlyRequested || consentData?.mode === "READONLY" || consentData?.canSubmit === false)
79-
return "readonly";
78+
if (consentData?.mode === "READONLY" || consentData?.canSubmit === false) return "readonly";
8079
return "write";
81-
}, [consentData?.canSubmit, consentData?.mode, readonlyRequested]);
80+
}, [consentData?.canSubmit, consentData?.mode]);
8281

8382
const isReadOnly = mode === "readonly";
8483

@@ -99,11 +98,14 @@ function ConsentPageContent({ params }: ConsentPageProps) {
9998
const activeDraft = draft.exhibitionId === id ? draft : null;
10099

101100
const checkedMap = useMemo(
102-
() => ({
103-
...serverCheckedMap,
104-
...(activeDraft?.checkedMap ?? {}),
105-
}),
106-
[activeDraft?.checkedMap, serverCheckedMap]
101+
() =>
102+
isReadOnly
103+
? serverCheckedMap
104+
: {
105+
...serverCheckedMap,
106+
...(activeDraft?.checkedMap ?? {}),
107+
},
108+
[activeDraft?.checkedMap, isReadOnly, serverCheckedMap]
107109
);
108110

109111
const signatureDataUrl = isReadOnly

src/components/exhibition-consent/SignatureSection.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ export default function SignatureSection({
6969
{isReadOnly ? (
7070
<div className="bg-bg-primary-darker border-border-primary flex h-[152px] items-center justify-center overflow-hidden rounded-lg border">
7171
{displaySignatureUrl ? (
72-
<div
73-
role="img"
72+
// eslint-disable-next-line @next/next/no-img-element
73+
<img
74+
src={displaySignatureUrl}
75+
alt="저장된 서명"
7476
aria-label="저장된 서명"
75-
className="h-full w-full bg-contain bg-center bg-no-repeat"
76-
style={{ backgroundImage: `url("${displaySignatureUrl}")` }}
77+
className="h-full w-full object-contain"
7778
/>
7879
) : (
7980
<p className="text-body-2 text-text-secondary">저장된 서명이 없습니다.</p>

src/services/exhibitionConsentApi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export function getExhibitionConsent(exhibitionId: number): Promise<ExhibitionCo
1010
}
1111

1212
export function getReadonlyExhibitionConsent(exhibitionId: number): Promise<ExhibitionConsent> {
13-
return apiClient.get<ExhibitionConsent>(
14-
`/api/v1/exhibitions/${exhibitionId}/consent?mode=readonly`
15-
);
13+
return apiClient.get<ExhibitionConsent>(`/api/v1/exhibitions/${exhibitionId}/consent`, {
14+
mode: "readonly",
15+
});
1616
}
1717

1818
export function submitExhibitionConsent(

0 commit comments

Comments
 (0)