@bzbs/react-api-client 2.0.1 → 2.0.3

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/index.mjs CHANGED
@@ -56,9 +56,26 @@ var BaseService = class {
56
56
  };
57
57
  }
58
58
  if (error.response && error.response.data) {
59
+ const data = error.response.data;
60
+ if (data["Success"]) {
61
+ return {
62
+ type: "server-error",
63
+ error: {
64
+ requestId: data.RequestId || "",
65
+ error: {
66
+ id: data.Code || data.code || error.response.status,
67
+ message: data.Message || data.message || error.response.statusText,
68
+ code: data.Code || data.code || error.response.status,
69
+ type: "buzzebees"
70
+ }
71
+ },
72
+ statusCode: error.response.status,
73
+ response: error.response
74
+ };
75
+ }
59
76
  return {
60
77
  type: "server-error",
61
- error: error.response.data,
78
+ error: data,
62
79
  statusCode: error.response.status,
63
80
  response: error.response
64
81
  };
@@ -567,10 +584,10 @@ var AuthenticateApi = class extends BaseService {
567
584
  * @param requestOptions - Optional request options.
568
585
  * @returns A promise that resolves to a ServiceResponse containing the forget password response.
569
586
  */
570
- forgetPassword(params, requestOptions) {
587
+ forgetPassword(params, requestOptions, version = 2) {
571
588
  return __async(this, null, function* () {
572
589
  return yield this.get(
573
- "profile/forget_password",
590
+ `profile/forget_password${version}`,
574
591
  __spreadValues({
575
592
  id: params.contact,
576
593
  type: params.type
@@ -591,10 +608,10 @@ var AuthenticateApi = class extends BaseService {
591
608
  * @param requestOptions - (Optional) Additional options for the request.
592
609
  * @returns A promise that resolves to a ServiceResponse containing the status response.
593
610
  */
594
- resetPassword(params, requestOptions) {
611
+ resetPassword(params, requestOptions, version = 2) {
595
612
  return __async(this, null, function* () {
596
613
  return yield this.post(
597
- "profile/forget_password",
614
+ `profile/forget_password${version}`,
598
615
  __spreadValues({
599
616
  id: params.contact,
600
617
  refcode: params.refCode,
@@ -1727,10 +1744,10 @@ var ProfileApi = class extends BaseService {
1727
1744
  * @param requestOptions - Optional request options.
1728
1745
  * @returns A promise that resolves to a ServiceResponse containing the status response.
1729
1746
  */
1730
- changePassword(params, requestOptions) {
1747
+ changePassword(params, requestOptions, version = 2) {
1731
1748
  return __async(this, null, function* () {
1732
1749
  return yield this.post(
1733
- "profile/change_password",
1750
+ `profile/change_password${version}`,
1734
1751
  __spreadValues({
1735
1752
  current: params.current,
1736
1753
  change: params.change
@@ -1993,10 +2010,10 @@ var RegistrationApi = class extends BaseService {
1993
2010
  * @param requestOptions - The optional request options.
1994
2011
  * @returns A promise that resolves to a service response containing the registration response.
1995
2012
  */
1996
- register(params, requestOptions) {
2013
+ register(params, requestOptions, version = 2) {
1997
2014
  return __async(this, null, function* () {
1998
2015
  return yield this.post(
1999
- "auth/register",
2016
+ `auth/register${version}`,
2000
2017
  __spreadValues({
2001
2018
  app_id: params.appId,
2002
2019
  uuid: params.uuid,