@appcorp/fusion-storybook 0.2.60 → 0.2.63

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.
@@ -188,7 +188,7 @@ export const ClassMoreActions = () => {
188
188
  showSuccessToast(t("messagesBulkSuccess"));
189
189
  }
190
190
  const schoolId = ((_f = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _f === void 0 ? void 0 : _f.id) || "";
191
- fetch(`${CLASS_API_ROUTES.LIST}?currentPage=1&pageLimit=${pageLimit}&schoolId=${schoolId}`, {
191
+ fetch(`${CLASS_API_ROUTES.UNIT}?currentPage=1&pageLimit=${pageLimit}&schoolId=${schoolId}`, {
192
192
  headers: {
193
193
  "Content-Type": "application/json",
194
194
  },
@@ -15,22 +15,28 @@ import { getCachedWorkspaceSync } from "../workspace/cache";
15
15
  import { CLASS_API_ROUTES } from "../../constants";
16
16
  import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
17
17
  import { API_METHODS } from "@react-pakistan/util-functions";
18
+ import { useEffect } from "react";
18
19
  export const SectionForm = () => {
20
+ var _a;
19
21
  const { state, handleChange } = useSectionModule();
20
22
  const { capacity, classId, enabled, errors, name } = state;
21
23
  const t = useTranslations("section");
22
24
  const workspace = getCachedWorkspaceSync();
23
- const { data: classes } = useFetch("/api/v1/class", {
25
+ const { fetchNow, data: classes } = useFetch(CLASS_API_ROUTES.UNIT, {
24
26
  params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
25
27
  method: API_METHODS.GET,
26
28
  });
29
+ useEffect(() => {
30
+ fetchNow();
31
+ // eslint-disable-next-line react-hooks/exhaustive-deps
32
+ }, []);
27
33
  const { enhancedComboboxElement: classIdCombo } = useEnhancedCombobox({
28
34
  emptyText: t("formNoClassEmpty"),
29
35
  id: "classId",
30
36
  info: t("formClassInfo"),
31
37
  label: t("formClassLabel"),
32
38
  onValueChange: (value) => handleChange("classId", value),
33
- options: (classes === null || classes === void 0 ? void 0 : classes.map((cls) => ({
39
+ options: ((_a = ((classes === null || classes === void 0 ? void 0 : classes.items) || [])) === null || _a === void 0 ? void 0 : _a.map((cls) => ({
34
40
  value: cls.id,
35
41
  label: `${cls.name} (${cls.code})`,
36
42
  }))) || [],
package/constants.d.ts CHANGED
@@ -14,7 +14,6 @@ export declare const ATTENDANCE_API_ROUTES: {
14
14
  export declare const ADMISSION_API_ROUTES: Record<string, string>;
15
15
  export declare const CAMPUS_API_ROUTES: Record<string, string>;
16
16
  export declare const CLASS_API_ROUTES: {
17
- readonly LIST: "/api/v1/class";
18
17
  readonly UNIT: "/api/v1/class";
19
18
  readonly BULK: "/api/v1/class/bulk";
20
19
  readonly BULK_STATUS: (jobId: string) => string;
package/constants.js CHANGED
@@ -21,7 +21,6 @@ export const CAMPUS_API_ROUTES = {
21
21
  UNIT: "/api/v1/campus",
22
22
  };
23
23
  export const CLASS_API_ROUTES = {
24
- LIST: "/api/v1/class",
25
24
  UNIT: "/api/v1/class",
26
25
  BULK: "/api/v1/class/bulk",
27
26
  BULK_STATUS: (jobId) => `/api/v1/class/bulk/${jobId}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.2.60",
3
+ "version": "0.2.63",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",