@churchapps/apphelper 0.3.14 → 0.3.15

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 +1 @@
1
- {"version":3,"file":"ErrorHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/ErrorHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIhF,qBAAa,WAAW;IAEtB,MAAM,CAAC,UAAU,EAAC,MAAM;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAC,CAAC;IACpG,MAAM,CAAC,kBAAkB,EAAC,CAAC,QAAQ,EAAC,iBAAiB,KAAK,IAAI,CAAC;IAE/D,MAAM,CAAC,IAAI,eAAe,MAAM,sBAAsB,iCAA+B,iBAAiB,KAAK,IAAI,UAG9G;IAED,MAAM,CAAC,QAAQ,cAAc,MAAM,WAAU,MAAM,WAAU,MAAM,UAqBlE;CAEF"}
1
+ {"version":3,"file":"ErrorHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/ErrorHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIhF,qBAAa,WAAW;IAEvB,MAAM,CAAC,UAAU,EAAE,MAAM;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IACtG,MAAM,CAAC,kBAAkB,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAEjE,MAAM,CAAC,IAAI,eAAgB,MAAM,sBAAsB,iCAAiC,iBAAiB,KAAK,IAAI,UAGjH;IAED,MAAM,CAAC,QAAQ,cAAe,MAAM,WAAW,MAAM,WAAW,MAAM,UAoBrE;CAED"}
@@ -27,7 +27,7 @@ ErrorHelper.logError = (errorType, message, details) => {
27
27
  console.log("ERROR LOG", log);
28
28
  if (log.errorType === "401" && log.message.indexOf("/users/login") > -1)
29
29
  return;
30
- ApiHelper_1.ApiHelper.postAnonymous("/errors", [log], "MembershipApi");
30
+ ApiHelper_1.ApiHelper.postAnonymous("/clientErrors", [log], "MembershipApi");
31
31
  if (_a.customErrorHandler)
32
32
  _a.customErrorHandler(log);
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorHelper.js","sourceRoot":"","sources":["../../src/helpers/ErrorHelper.ts"],"names":[],"mappings":";;;;AACA,2CAAwC;AAGxC,MAAa,WAAW;;AAAxB,kCAiCC;;AA5BQ,gBAAI,GAAG,CAAC,UAAuC,EAAE,kBAAuD,EAAE,EAAE;IACjH,EAAW,CAAC,UAAU,GAAG,UAAU,CAAC;IACpC,EAAW,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AACtD,CAAC,AAHU,CAGV;AAEM,oBAAQ,GAAG,CAAC,SAAgB,EAAE,OAAc,EAAE,OAAc,EAAE,EAAE;IACrE,IAAI,EAAI,CAAC,UAAU,EACnB;QACE,MAAM,IAAI,GAAG,EAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAqB;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,OAAO;SACjB,CAAA;QAED,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAE9B,IAAI,GAAG,CAAC,SAAS,KAAG,KAAK,IAAI,GAAG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F,qBAAS,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,CAAC;QACjE,IAAI,EAAW,CAAC,kBAAkB;YAAE,EAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;KACxE;AACF,CAAC,AApBc,CAoBd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@churchapps/apphelper",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "description": "Library of helper functions for React and NextJS ChurchApps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,35 +4,34 @@ import { ApiHelper } from "./ApiHelper";
4
4
 
5
5
  export class ErrorHelper {
6
6
 
7
- static getAppData:() => { churchId: string, userId: string, originUrl: string, application: string};
8
- static customErrorHandler:(errorLog:ErrorLogInterface) => void;
9
-
10
- static init = (getAppData:() => ErrrorAppDataInterface, customErrorHandler:(errorLog:ErrorLogInterface) => void) => {
11
- ErrorHelper.getAppData = getAppData;
12
- ErrorHelper.customErrorHandler = customErrorHandler;
13
- }
14
-
15
- static logError = (errorType:string, message:string, details:string) => {
16
- if (this.getAppData)
17
- {
18
- const data = this.getAppData();
19
- const log:ErrorLogInterface = {
20
- application: data.application,
21
- errorTime: new Date(),
22
- userId: data.userId,
23
- churchId: data.churchId,
24
- originUrl: data.originUrl,
25
- errorType: errorType,
26
- message: message,
27
- details: details
28
- }
29
-
30
- console.log("ERROR LOG", log);
31
-
32
- if (log.errorType==="401" && log.message.indexOf("/users/login")>-1) return;
33
- ApiHelper.postAnonymous("/errors", [log], "MembershipApi");
34
- if (ErrorHelper.customErrorHandler) ErrorHelper.customErrorHandler(log);
35
- }
36
- }
7
+ static getAppData: () => { churchId: string, userId: string, originUrl: string, application: string };
8
+ static customErrorHandler: (errorLog: ErrorLogInterface) => void;
9
+
10
+ static init = (getAppData: () => ErrrorAppDataInterface, customErrorHandler: (errorLog: ErrorLogInterface) => void) => {
11
+ ErrorHelper.getAppData = getAppData;
12
+ ErrorHelper.customErrorHandler = customErrorHandler;
13
+ }
14
+
15
+ static logError = (errorType: string, message: string, details: string) => {
16
+ if (this.getAppData) {
17
+ const data = this.getAppData();
18
+ const log: ErrorLogInterface = {
19
+ application: data.application,
20
+ errorTime: new Date(),
21
+ userId: data.userId,
22
+ churchId: data.churchId,
23
+ originUrl: data.originUrl,
24
+ errorType: errorType,
25
+ message: message,
26
+ details: details
27
+ }
28
+
29
+ console.log("ERROR LOG", log);
30
+
31
+ if (log.errorType === "401" && log.message.indexOf("/users/login") > -1) return;
32
+ ApiHelper.postAnonymous("/clientErrors", [log], "MembershipApi");
33
+ if (ErrorHelper.customErrorHandler) ErrorHelper.customErrorHandler(log);
34
+ }
35
+ }
37
36
 
38
37
  }