gomtm 0.0.189 → 0.0.190

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.
@@ -44,7 +44,7 @@ const CommonListItemView = (props) => {
44
44
  // item.id == curd.activateId && " font-bold"
45
45
  ),
46
46
  "aria-label": item.id,
47
- children: /* @__PURE__ */ jsxs(MtLink, { href: `/gomtmadmin/${slug}/${item.id}`, children: [
47
+ children: /* @__PURE__ */ jsxs(MtLink, { href: `/admin/${slug}/${item.id}`, children: [
48
48
  item.title || item.id,
49
49
  item.description && /* @__PURE__ */ jsx("div", { children: item.description })
50
50
  ] })
@@ -103,6 +103,7 @@ const gomtmFetcher = (initGlobal) => {
103
103
  }), headerCookie && { "Cookie": headerCookie })
104
104
  });
105
105
  let fetcher = fetch;
106
+ req.enableCache = false;
106
107
  if (req.enableCache) {
107
108
  fetcher = fetchMiddleWithCache(fetch);
108
109
  }
@@ -110,7 +111,11 @@ const gomtmFetcher = (initGlobal) => {
110
111
  const responseData = yield fetcher(input, init);
111
112
  return responseData;
112
113
  } catch (e) {
113
- console.error("mtmfetch error", e);
114
+ console.error("[mtmfetch error]", {
115
+ input,
116
+ error: e,
117
+ init
118
+ });
114
119
  const errorRsp = {
115
120
  errCode: "-1",
116
121
  errMessage: (e == null ? void 0 : e.toString()) || "unknow error"
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const GomtmCurdDetailView: () => import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useSuspenseQuery } from "../connectquery";
4
+ import { curdViewGet } from "../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
5
+ import { useCurdSlugName } from "./hooks";
6
+ const GomtmCurdDetailView = () => {
7
+ const nameSlug = useCurdSlugName();
8
+ const curdGetQuery = useSuspenseQuery(curdViewGet, {
9
+ name: nameSlug
10
+ });
11
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "bg-blue-200 p-2", children: [
12
+ "nameSlug:",
13
+ nameSlug,
14
+ /* @__PURE__ */ jsx("pre", { children: JSON.stringify(curdGetQuery.data, null, 2) })
15
+ ] }) });
16
+ };
17
+ export {
18
+ GomtmCurdDetailView
19
+ };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const GomtmCurdListView: () => import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useSuspenseQuery } from "../connectquery";
4
+ import { ListItemView } from "../curd/list-item/ListItem";
5
+ import { curdList } from "../gomtmpb/mtm/sppb/curd-CurdService_connectquery";
6
+ import { useCurdSlugName } from "./hooks";
7
+ const GomtmCurdListView = () => {
8
+ var _a, _b;
9
+ const slugName = useCurdSlugName();
10
+ const listQuery = useSuspenseQuery(curdList, {
11
+ params: {
12
+ slugs: slugName
13
+ }
14
+ });
15
+ return /* @__PURE__ */ jsx("div", { className: " bg-cyan-500", children: ((_a = listQuery.data.error) == null ? void 0 : _a.code) ? /* @__PURE__ */ jsxs("div", { children: [
16
+ "error: ",
17
+ listQuery.data.error.code
18
+ ] }) : /* @__PURE__ */ jsx(Fragment, { children: (_b = listQuery.data.items) == null ? void 0 : _b.map((item, i) => {
19
+ return /* @__PURE__ */ jsx(ListItemView, { item }, i);
20
+ }) }) });
21
+ };
22
+ export {
23
+ GomtmCurdListView
24
+ };
@@ -0,0 +1 @@
1
+ export declare const useCurdSlugName: () => string | undefined;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { usePathname } from "next/navigation";
3
+ import { useMemo } from "react";
4
+ const useCurdSlugName = () => {
5
+ const pathname = usePathname();
6
+ const nameSlug = useMemo(() => {
7
+ const a = pathname.split("/");
8
+ if (a.length >= 2) {
9
+ return a[2];
10
+ }
11
+ }, [pathname]);
12
+ return nameSlug;
13
+ };
14
+ export {
15
+ useCurdSlugName
16
+ };
@@ -24,8 +24,9 @@ const curd3BackendUrlAtom = atom((get) => {
24
24
  });
25
25
  const transportAtom = atom((get) => {
26
26
  const baseUrl = get(curd3BackendUrlAtom);
27
+ const baseUrl2 = new URL("/api", baseUrl).toString();
27
28
  return createConnectTransport({
28
- baseUrl,
29
+ baseUrl: baseUrl2,
29
30
  fetch: gomtmFetcher()
30
31
  });
31
32
  });