gomtm 0.0.221 → 0.0.222
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/dist/esm/mtmFetcher.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ServiceType } from "@bufbuild/protobuf";
|
|
|
2
2
|
export declare function createMtmServiceClient<T extends ServiceType>(service: T, url?: string): import("@connectrpc/connect").PromiseClient<T>;
|
|
3
3
|
export declare function createMtmServiceClientByName<T extends ServiceType>(svcName: string, url?: string): import("@connectrpc/connect").PromiseClient<ServiceType>;
|
|
4
4
|
type CustomRequestInit = RequestInit & {
|
|
5
|
+
cookieStr?: string;
|
|
5
6
|
enableCache?: boolean;
|
|
6
7
|
enableLog?: boolean;
|
|
7
8
|
};
|
package/dist/esm/mtmFetcher.js
CHANGED
|
@@ -89,19 +89,13 @@ const gomtmFetcher = (initGlobal) => {
|
|
|
89
89
|
const req = merge(init, initGlobal, {
|
|
90
90
|
redirect: "follow"
|
|
91
91
|
}) || {};
|
|
92
|
-
let headerCookie = "";
|
|
93
|
-
if (typeof window == "undefined") {
|
|
94
|
-
console.log("mtmFetcher.ts require next/headers");
|
|
95
|
-
const reqHeaders = require("next/headers").headers();
|
|
96
|
-
headerCookie = reqHeaders.get("Cookie");
|
|
97
|
-
}
|
|
98
92
|
if (!init) {
|
|
99
93
|
init = {};
|
|
100
94
|
}
|
|
101
95
|
init = __spreadValues(__spreadValues({}, init), {
|
|
102
96
|
headers: __spreadValues(__spreadProps(__spreadValues({}, init.headers), {
|
|
103
97
|
"Content-Type": "application/json"
|
|
104
|
-
}),
|
|
98
|
+
}), (initGlobal == null ? void 0 : initGlobal.cookieStr) && { "Cookie": initGlobal == null ? void 0 : initGlobal.cookieStr })
|
|
105
99
|
});
|
|
106
100
|
let fetcher = fetch;
|
|
107
101
|
req.enableCache = false;
|
|
@@ -30,9 +30,16 @@ const cookiesAtom = atom((get) => {
|
|
|
30
30
|
const transportAtom = atom((get) => {
|
|
31
31
|
const baseUrl = get(curd3BackendUrlAtom);
|
|
32
32
|
const baseUrl2 = new URL("/api", baseUrl).toString();
|
|
33
|
+
const cookiesStr = get(cookiesAtom);
|
|
34
|
+
console.log("transportAtom :", {
|
|
35
|
+
baseUrl2,
|
|
36
|
+
cookiesStr
|
|
37
|
+
});
|
|
33
38
|
return createConnectTransport({
|
|
34
39
|
baseUrl: baseUrl2,
|
|
35
|
-
fetch: gomtmFetcher(
|
|
40
|
+
fetch: gomtmFetcher({
|
|
41
|
+
cookieStr: cookiesStr
|
|
42
|
+
})
|
|
36
43
|
});
|
|
37
44
|
});
|
|
38
45
|
const useGomtmBackend = () => {
|