@daeryun/dr_components 0.3.76 → 0.3.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,6 +47,7 @@ interface IRequiredCheckItem {
47
47
  name: string;
48
48
  isContent: boolean;
49
49
  termCode: string;
50
+ contents: string;
50
51
  isAll?: boolean;
51
52
  }
52
53
 
@@ -63,11 +64,39 @@ const SignContainer = ({
63
64
  const [termCode, setTermCode] = useState<string>('');
64
65
 
65
66
  const [requiredTermItems, setRequiredTermItems] = useState<IRequiredCheckItem[]>([
66
- { title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true, termCode: '' },
67
- { title: '만 14세 이상 동의 (필수)', name: 'required', checked: false, isContent: false, termCode: '' },
68
- { title: '서비스 이용약관 동의 (필수)', name: 'required', checked: false, isContent: true, termCode: '' },
69
- { title: '개인정보 수집·이용 동의 (필수)', name: 'required', checked: false, isContent: true, termCode: '' },
70
- { title: '개인정보 제3자 제공 동의 (필수)', name: 'required', checked: false, isContent: true, termCode: '' }
67
+ { title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true, termCode: '', contents: '' },
68
+ {
69
+ title: '만 14세 이상 동의 (필수)',
70
+ name: 'required',
71
+ checked: false,
72
+ isContent: false,
73
+ termCode: '',
74
+ contents: ''
75
+ },
76
+ {
77
+ title: '서비스 이용약관 동의 (필수)',
78
+ name: 'required',
79
+ checked: false,
80
+ isContent: true,
81
+ termCode: '',
82
+ contents: ''
83
+ },
84
+ {
85
+ title: '개인정보 수집·이용 동의 (필수)',
86
+ name: 'required',
87
+ checked: false,
88
+ isContent: true,
89
+ termCode: '',
90
+ contents: ''
91
+ },
92
+ {
93
+ title: '개인정보 제3자 제공 동의 (필수)',
94
+ name: 'required',
95
+ checked: false,
96
+ isContent: true,
97
+ termCode: '',
98
+ contents: ''
99
+ }
71
100
  ]);
72
101
 
73
102
  const { data: termList, status: termListStatus } = useQuery<ITermType[]>({
@@ -81,26 +110,23 @@ const SignContainer = ({
81
110
  }
82
111
  });
83
112
 
84
- const { data: termObj, status: termObjStatus } = useQuery<ITermType>({
85
- queryKey: ['term', termCode],
86
- queryFn: () => {
87
- return fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/terms/latest/${termCode}`, {
88
- method: 'GET'
89
- })
90
- .then(obj => obj.json())
91
- .then(obj => obj.data);
92
- },
93
- enabled: !!termCode
94
- });
95
-
96
113
  useEffect(() => {
97
114
  if (termListStatus === 'success' && Array.isArray(termList)) {
98
115
  setRequiredTermItems([
99
- { title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true, termCode: '' },
116
+ {
117
+ title: '전체 동의',
118
+ name: 'all',
119
+ checked: false,
120
+ isContent: false,
121
+ isAll: true,
122
+ termCode: '',
123
+ contents: ''
124
+ },
100
125
  ...(termList?.map(item => ({
101
126
  title: `${item.code_name} (필수)`,
102
127
  name: 'required',
103
128
  checked: false,
129
+ contents: item.contents || '',
104
130
  isContent: !!item.contents,
105
131
  termCode: item.terms_code || ''
106
132
  })) ?? [])
@@ -460,7 +486,7 @@ const SignContainer = ({
460
486
  setModalObj({ title: '', subTitle: '', key: '' });
461
487
  };
462
488
 
463
- if (termListStatus !== 'success' || (termCode && termObjStatus !== 'success')) {
489
+ if (termListStatus !== 'success') {
464
490
  return <Loader fullScreen />;
465
491
  }
466
492
 
@@ -863,8 +889,13 @@ const SignContainer = ({
863
889
  setTermCode('');
864
890
  setIsTermModal(false);
865
891
  }}
866
- title={(termObj && `${termObj.code_name} (필수)`) || ''}
867
- content={(termObj && termObj.contents) || ''}
892
+ title={
893
+ (termCode && `${requiredTermItems.find(fi => fi.termCode === termCode)?.title || ''} (필수)`) ||
894
+ ''
895
+ }
896
+ content={
897
+ (termCode && `${requiredTermItems.find(fi => fi.termCode === termCode)?.contents || ''}`) || ''
898
+ }
868
899
  />
869
900
  </section>
870
901
  </Suspense>