@uniai-fe/uds-templates 0.1.22 → 0.1.24

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniai-fe/uds-templates",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "UNIAI Design System; UI Templates Package",
5
5
  "type": "module",
6
6
  "private": false,
@@ -144,6 +144,93 @@ export interface API_Res_LoginGroup {
144
144
  status: number;
145
145
  }
146
146
 
147
+ /**
148
+ * 로그인 API; 응답 - 접근권한 메뉴 정보
149
+ * @route /auth/user/login
150
+ */
151
+ export interface API_Res_LoginRuleMenu {
152
+ /**
153
+ * 메뉴 id
154
+ */
155
+ id: number;
156
+ /**
157
+ * 상위 메뉴 id
158
+ */
159
+ parent_id: number;
160
+ /**
161
+ * 메뉴명
162
+ */
163
+ name: string;
164
+ /**
165
+ * 메뉴 설명
166
+ */
167
+ description: string;
168
+ /**
169
+ * 메뉴권한 생성일 yyyy-MM-ddTHH:mm:ss
170
+ */
171
+ created_at: string;
172
+ flag: number;
173
+ status: number;
174
+ }
175
+
176
+ /**
177
+ * 로그인 API; 응답 - 접근권한 정보
178
+ * @route /auth/user/login
179
+ */
180
+ export interface API_Res_LoginRule {
181
+ /**
182
+ * 권한 id
183
+ */
184
+ id: number;
185
+ /**
186
+ * 권한명
187
+ */
188
+ name: string;
189
+ /**
190
+ * 권한이 부여된 농장 id
191
+ */
192
+ farm_id: number;
193
+ /**
194
+ * 권한이 부여된 농장 사육동 번호
195
+ */
196
+ building_no: number;
197
+ /**
198
+ * 읽기 권한 여부
199
+ * - 0: 없음
200
+ * - 1: 있음
201
+ */
202
+ can_read: number;
203
+ /**
204
+ * 쓰기 권한 여부
205
+ * - 0: 없음
206
+ * - 1: 있음
207
+ */
208
+ can_write: number;
209
+ /**
210
+ * 생성 유저 id
211
+ */
212
+ create_userid: number;
213
+ /**
214
+ * 권한 생성일
215
+ * - yyyy-MM-ddTHH:mm:ss
216
+ */
217
+ created_at: string;
218
+ /**
219
+ * 권한이 속한 그룹 id
220
+ */
221
+ group_id: number;
222
+ /**
223
+ * 권한이 부여된 메뉴 id
224
+ */
225
+ menu_id: number;
226
+ /**
227
+ * 접근 권한 메뉴 정보
228
+ */
229
+ menu: API_Res_LoginRuleMenu;
230
+ flag: number;
231
+ status: number;
232
+ }
233
+
147
234
  /**
148
235
  * 로그인 API; 응답 - 역할 정보
149
236
  * @route /auth/user/login
@@ -182,7 +269,10 @@ export interface API_Res_LoginRole {
182
269
  * - yyyy-MM-ddTHH:mm:ss
183
270
  */
184
271
  created_at: string;
185
- rules: [];
272
+ /**
273
+ * 접근권한 정보 목록
274
+ */
275
+ rules: API_Res_LoginRule[];
186
276
  }
187
277
 
188
278
  /**
@@ -1,23 +1,23 @@
1
1
  "use client";
2
2
 
3
3
  import { useEffect, useMemo } from "react";
4
- import { useFormContext } from "react-hook-form";
5
4
  import { useQueryCctvCompanyList } from "../apis";
6
5
  import { useCctvEndpoints } from "../components/Provider";
7
- import type { CctvContext } from "../types";
6
+ import useCctvContext from "./useContext";
8
7
 
9
8
  export default function useCctvCompanyData({
10
9
  username,
11
10
  url,
12
11
  }: {
13
- username: string;
12
+ username?: string;
14
13
  url?: string;
15
14
  }) {
16
15
  const { listUrl } = useCctvEndpoints();
17
16
  const resolvedUrl = useMemo(() => url ?? listUrl, [url, listUrl]);
18
- const { setValue } = useFormContext<CctvContext>();
17
+ const { username: contextUsername, setValue } = useCctvContext();
18
+
19
19
  const { data, isFetching, isError, ...rest } = useQueryCctvCompanyList({
20
- username,
20
+ username: username ?? contextUsername,
21
21
  url: resolvedUrl,
22
22
  });
23
23
 
@@ -17,10 +17,10 @@ import { getCam, getCamList, getCompany } from "../utils/select";
17
17
  export default function useCctvContext(params?: { pageCode?: string }) {
18
18
  const { pageCode } = params ?? {};
19
19
 
20
- // const username = useCctvUsername();
21
20
  const setCtx = useSetAtom(cctvSelectedContext);
22
21
  const { control, setValue, ...context } = useFormContext<CctvContext>();
23
22
 
23
+ const username = useWatch({ control, name: "username" });
24
24
  const rawData = useWatch({ control, name: "rawData" });
25
25
  // console.log("useCctvContext rawData:", rawData);
26
26
  const isFetching = useWatch({ control, name: "isFetching" });
@@ -132,6 +132,7 @@ export default function useCctvContext(params?: { pageCode?: string }) {
132
132
  return {
133
133
  isFetching,
134
134
  isError,
135
+ username,
135
136
  searchedKeyword,
136
137
  selectedCompanyId,
137
138
  selectedCamId,