sales-frontend-api 0.0.136 → 0.0.138

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/server.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { a as GetterAsync, b as SetterAsync } from './header.types-duHbFvO0.cjs';
2
2
  export { A as AT, G as GetterSync, S as SetterSync, c as customHeaderNames } from './header.types-duHbFvO0.cjs';
3
+ import { AxiosRequestConfig, AxiosInstance } from 'axios';
3
4
 
4
5
  /**
5
6
  * 서버사이드용 쿠키함수
@@ -138,4 +139,20 @@ declare class HttpClientFetch extends FetchInstance {
138
139
  constructor(config?: HttpClientConfig);
139
140
  }
140
141
 
141
- export { FetchInstance, GetterAsync, HeaderFunc, HeaderManagerAsync, type HttpClientConfig, HttpClientFetch, HttpError, type Interceptor, type RequestConfig, SetterAsync, cookieServer };
142
+ /**
143
+ * 전자청약
144
+ * SSR용 http-client 입니다.
145
+ * cookie , redirect , token 처리 방식은 SSR 환경에 맞게 구현됩니다.
146
+ */
147
+ declare class HttpServerAxios {
148
+ config: AxiosRequestConfig;
149
+ /**
150
+ * axios의 request interceptor 동작시, 헤더에 주입될 헤더의 key,value
151
+ */
152
+ headers: Record<string, string>;
153
+ api: AxiosInstance;
154
+ constructor(config?: AxiosRequestConfig);
155
+ setHeaders(headers: Record<string, string>): void;
156
+ }
157
+
158
+ export { FetchInstance, GetterAsync, HeaderFunc, HeaderManagerAsync, type HttpClientConfig, HttpClientFetch, HttpError, HttpServerAxios, type Interceptor, type RequestConfig, SetterAsync, cookieServer };
package/dist/server.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { a as GetterAsync, b as SetterAsync } from './header.types-duHbFvO0.js';
2
2
  export { A as AT, G as GetterSync, S as SetterSync, c as customHeaderNames } from './header.types-duHbFvO0.js';
3
+ import { AxiosRequestConfig, AxiosInstance } from 'axios';
3
4
 
4
5
  /**
5
6
  * 서버사이드용 쿠키함수
@@ -138,4 +139,20 @@ declare class HttpClientFetch extends FetchInstance {
138
139
  constructor(config?: HttpClientConfig);
139
140
  }
140
141
 
141
- export { FetchInstance, GetterAsync, HeaderFunc, HeaderManagerAsync, type HttpClientConfig, HttpClientFetch, HttpError, type Interceptor, type RequestConfig, SetterAsync, cookieServer };
142
+ /**
143
+ * 전자청약
144
+ * SSR용 http-client 입니다.
145
+ * cookie , redirect , token 처리 방식은 SSR 환경에 맞게 구현됩니다.
146
+ */
147
+ declare class HttpServerAxios {
148
+ config: AxiosRequestConfig;
149
+ /**
150
+ * axios의 request interceptor 동작시, 헤더에 주입될 헤더의 key,value
151
+ */
152
+ headers: Record<string, string>;
153
+ api: AxiosInstance;
154
+ constructor(config?: AxiosRequestConfig);
155
+ setHeaders(headers: Record<string, string>): void;
156
+ }
157
+
158
+ export { FetchInstance, GetterAsync, HeaderFunc, HeaderManagerAsync, type HttpClientConfig, HttpClientFetch, HttpError, HttpServerAxios, type Interceptor, type RequestConfig, SetterAsync, cookieServer };
package/dist/server.js CHANGED
@@ -1,3 +1,5 @@
1
+ import axios, { AxiosError } from 'axios';
2
+
1
3
  var __create = Object.create;
2
4
  var __defProp = Object.defineProperty;
3
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -4558,6 +4560,61 @@ var HttpClientFetch = class extends FetchInstance {
4558
4560
  });
4559
4561
  }
4560
4562
  };
4563
+ var HttpServerAxios = class {
4564
+ constructor(config = {}) {
4565
+ __publicField(this, "config");
4566
+ /**
4567
+ * axios의 request interceptor 동작시, 헤더에 주입될 헤더의 key,value
4568
+ */
4569
+ __publicField(this, "headers", {});
4570
+ __publicField(this, "api");
4571
+ this.config = config;
4572
+ this.api = axios.create({
4573
+ withCredentials: false,
4574
+ ...config
4575
+ });
4576
+ this.api.interceptors.request.use(
4577
+ async (config2) => {
4578
+ console.log("config url", config2.url);
4579
+ const headerEntries = Object.entries(this.headers);
4580
+ headerEntries.forEach(([key, value]) => {
4581
+ if (config2?.headers) {
4582
+ config2.headers[key] = value;
4583
+ }
4584
+ });
4585
+ return config2;
4586
+ },
4587
+ async (error) => {
4588
+ console.log("request error");
4589
+ return Promise.reject(error);
4590
+ }
4591
+ );
4592
+ this.api.interceptors.response.use(
4593
+ async (response) => {
4594
+ if (response.data.isSuccess === false) {
4595
+ const axiosError = new AxiosError();
4596
+ axiosError.response = response;
4597
+ axiosError.config = response.config;
4598
+ axiosError.message = response.data.message;
4599
+ axiosError.code = response.status.toString();
4600
+ axiosError.request = response.request;
4601
+ return Promise.reject(axiosError);
4602
+ }
4603
+ return response;
4604
+ },
4605
+ async (error) => {
4606
+ console.log("error");
4607
+ return Promise.reject(error);
4608
+ }
4609
+ );
4610
+ }
4611
+ setHeaders(headers2) {
4612
+ this.headers = {
4613
+ ...this.headers,
4614
+ ...headers2
4615
+ };
4616
+ }
4617
+ };
4561
4618
  /*! Bundled license information:
4562
4619
 
4563
4620
  react/cjs/react.production.js:
@@ -4583,6 +4640,6 @@ react/cjs/react.development.js:
4583
4640
  *)
4584
4641
  */
4585
4642
 
4586
- export { AT, FetchInstance, HeaderFunc, HeaderManagerAsync, HttpClientFetch, HttpError, cookieServer, customHeaderNames };
4643
+ export { AT, FetchInstance, HeaderFunc, HeaderManagerAsync, HttpClientFetch, HttpError, HttpServerAxios, cookieServer, customHeaderNames };
4587
4644
  //# sourceMappingURL=server.js.map
4588
4645
  //# sourceMappingURL=server.js.map