@uniai-fe/uds-templates 0.1.23 → 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.23",
3
+ "version": "0.1.24",
4
4
  "description": "UNIAI Design System; UI Templates Package",
5
5
  "type": "module",
6
6
  "private": false,
@@ -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,