50p82u21t54k 0.0.2 → 0.0.4

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.
@@ -1,19 +1,32 @@
1
- let t = "";
2
- function s(n) {
3
- t = n;
1
+ let n = "";
2
+ function o(t) {
3
+ n = t;
4
4
  }
5
- function a() {
6
- return t;
5
+ function r() {
6
+ return `${n}/api`;
7
7
  }
8
- const r = {
9
- install(n, e) {
10
- s(e.baseURL);
8
+ const u = {
9
+ install(t, a) {
10
+ o(a.baseURL);
11
11
  }
12
12
  };
13
- async function u() {
14
- return a();
13
+ async function c() {
14
+ try {
15
+ const t = `${r()}/products`, a = await fetch(t, {
16
+ method: "GET"
17
+ }), e = await a.text(), s = {
18
+ status: a.status,
19
+ data: ""
20
+ };
21
+ return s.status != 200 ? (console.log("!200"), s.data = e, s) : (a.ok && (console.log(JSON.parse(e)), s.data = e), s);
22
+ } catch (t) {
23
+ return {
24
+ status: -1,
25
+ data: `${t}`
26
+ };
27
+ }
15
28
  }
16
29
  export {
17
- u as getProduct,
18
- r as libraryPlugin
30
+ c as getProducts,
31
+ u as libraryPlugin
19
32
  };
@@ -1 +1 @@
1
- (function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e["50p82u21t54k"]={}))})(this,function(e){"use strict";let t="";function i(n){t=n}function u(){return t}const o={install(n,s){i(s.baseURL)}};async function f(){return u()}e.getProduct=f,e.libraryPlugin=o,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t["50p82u21t54k"]={}))})(this,function(t){"use strict";let e="";function a(n){e=n}function i(){return`${e}/api`}const r={install(n,o){a(o.baseURL)}};async function c(){try{const n=`${i()}/products`,o=await fetch(n,{method:"GET"}),u=await o.text(),s={status:o.status,data:""};return s.status!=200?(console.log("!200"),s.data=u,s):(o.ok&&(console.log(JSON.parse(u)),s.data=u),s)}catch(n){return{status:-1,data:`${n}`}}}t.getProducts=c,t.libraryPlugin=r,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
@@ -1,2 +1,4 @@
1
- export declare function getProduct(): Promise<string>;
1
+ import { ReturnData } from '../util/type';
2
+
3
+ export declare function getProducts(): Promise<ReturnData>;
2
4
  //# sourceMappingURL=method.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../src/products/method.ts"],"names":[],"mappings":"AAEA,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAElD"}
1
+ {"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../src/products/method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,wBAAsB,WAAW,IAAI,OAAO,CAAC,UAAU,CAAC,CA0CvD"}
@@ -0,0 +1,5 @@
1
+ export type ReturnData = {
2
+ status: number;
3
+ data: string;
4
+ };
5
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/util/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "50p82u21t54k",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "A description of your library",
5
5
  "main": "dist/50p82u21t54k.umd.js",
6
6
  "module": "dist/50p82u21t54k.es.js",