washday-sdk 0.0.53 → 0.0.55
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/api/cashierbox/delete.js +15 -0
- package/dist/api/cashierbox/get.js +34 -0
- package/dist/api/cashierbox/post.js +16 -0
- package/dist/api/cashierbox/put.js +16 -0
- package/dist/api/index.js +19 -13
- package/dist/api/staff/delete.js +2 -1
- package/dist/api/staff/get.js +18 -2
- package/dist/api/staff/post.js +2 -2
- package/dist/api/stores/post.js +0 -4
- package/package.json +1 -1
- package/src/api/cashierbox/delete.ts +15 -0
- package/src/api/cashierbox/get.ts +18 -0
- package/src/api/cashierbox/post.ts +17 -0
- package/src/api/cashierbox/put.ts +16 -0
- package/src/api/index.ts +8 -1
- package/src/api/staff/delete.ts +2 -1
- package/src/api/staff/get.ts +14 -2
- package/src/api/staff/post.ts +2 -2
- package/src/api/stores/post.ts +0 -5
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { WashdayClientInstance } from "../../interfaces/Api";
|
|
3
|
+
// import axiosInstance from "../axiosInstance";
|
|
4
|
+
// export const deleteStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string): Promise<any> {
|
|
5
|
+
// try {
|
|
6
|
+
// const config = {
|
|
7
|
+
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
8
|
+
// };
|
|
9
|
+
// const response = await axiosInstance.delete(`api/store/${storeId}/staff/${staffId}`, config);
|
|
10
|
+
// return response;
|
|
11
|
+
// } catch (error) {
|
|
12
|
+
// console.error('Error fetching getStoreStaff:', error);
|
|
13
|
+
// throw error;
|
|
14
|
+
// }
|
|
15
|
+
// };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getCashierboxesByStoreId = exports.GET_SET_CASHIER_BOX = void 0;
|
|
16
|
+
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
|
|
18
|
+
exports.GET_SET_CASHIER_BOX = GET_SET_CASHIER_BOX;
|
|
19
|
+
const getCashierboxesByStoreId = function (storeId, queryParams) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
const config = {
|
|
23
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
24
|
+
};
|
|
25
|
+
const response = yield axiosInstance_1.default.get(`${(0, exports.GET_SET_CASHIER_BOX)(storeId)}?${queryParams}`, config);
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('Error fetching getStoreStaff:', error);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
exports.getCashierboxesByStoreId = getCashierboxesByStoreId;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { WashdayClientInstance } from "../../interfaces/Api";
|
|
3
|
+
// import axiosInstance from "../axiosInstance";
|
|
4
|
+
// const GET_SET_STORES = 'api/store';
|
|
5
|
+
// export const createStoreStaff = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
|
|
6
|
+
// try {
|
|
7
|
+
// const config = {
|
|
8
|
+
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
// };
|
|
10
|
+
// const response = await axiosInstance.post(`api/store/${storeId}/staff`, data, config);
|
|
11
|
+
// return response;
|
|
12
|
+
// } catch (error) {
|
|
13
|
+
// console.error('Error fetching createStoreImage:', error);
|
|
14
|
+
// throw error;
|
|
15
|
+
// }
|
|
16
|
+
// };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { WashdayClientInstance } from "../../interfaces/Api";
|
|
3
|
+
// import { IStore } from "../../interfaces/Store";
|
|
4
|
+
// import axiosInstance from "../axiosInstance";
|
|
5
|
+
// export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<any> {
|
|
6
|
+
// try {
|
|
7
|
+
// const config = {
|
|
8
|
+
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
// };
|
|
10
|
+
// const response = await axiosInstance.put(`api/store/${storeId}/staff`, data, config);
|
|
11
|
+
// return response;
|
|
12
|
+
// } catch (error) {
|
|
13
|
+
// console.error('Error fetching getStoreById:', error);
|
|
14
|
+
// throw error;
|
|
15
|
+
// }
|
|
16
|
+
// };
|
package/dist/api/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const get_1 = require("./
|
|
3
|
+
const get_1 = require("./cashierbox/get");
|
|
4
|
+
const get_2 = require("./companies/get");
|
|
4
5
|
const post_1 = require("./companies/post");
|
|
5
6
|
const put_1 = require("./companies/put");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
7
|
+
const get_3 = require("./countries/get");
|
|
8
|
+
const get_4 = require("./customers/get");
|
|
8
9
|
const put_2 = require("./products/put");
|
|
9
10
|
const delete_1 = require("./staff/delete");
|
|
10
|
-
const
|
|
11
|
+
const get_5 = require("./staff/get");
|
|
11
12
|
const post_2 = require("./staff/post");
|
|
12
13
|
const put_3 = require("./staff/put");
|
|
13
|
-
const
|
|
14
|
+
const get_6 = require("./stores/get");
|
|
14
15
|
const post_3 = require("./stores/post");
|
|
15
16
|
const put_4 = require("./stores/put");
|
|
16
17
|
const post_4 = require("./stripe/post");
|
|
@@ -25,17 +26,18 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
25
26
|
WashdayClient.prototype.companies.apiToken = apiToken;
|
|
26
27
|
WashdayClient.prototype.stripe.apiToken = apiToken;
|
|
27
28
|
WashdayClient.prototype.staff.apiToken = apiToken;
|
|
29
|
+
WashdayClient.prototype.cashierboxes.apiToken = apiToken;
|
|
28
30
|
};
|
|
29
31
|
WashdayClient.prototype.customers = {
|
|
30
|
-
getCustomerById:
|
|
31
|
-
getCustomerHighlightsById:
|
|
32
|
+
getCustomerById: get_4.getCustomerById,
|
|
33
|
+
getCustomerHighlightsById: get_4.getCustomerHighlightsById
|
|
32
34
|
};
|
|
33
35
|
WashdayClient.prototype.stores = {
|
|
34
|
-
getStores:
|
|
35
|
-
getStoreById:
|
|
36
|
+
getStores: get_6.getStores,
|
|
37
|
+
getStoreById: get_6.getStoreById,
|
|
36
38
|
updateStoreById: put_4.updateStoreById,
|
|
37
39
|
createStoreImage: post_3.createStoreImage,
|
|
38
|
-
getStoreReviewLink:
|
|
40
|
+
getStoreReviewLink: get_6.getStoreReviewLink
|
|
39
41
|
};
|
|
40
42
|
WashdayClient.prototype.products = {
|
|
41
43
|
bulkUpdate: put_2.bulkUpdate,
|
|
@@ -44,10 +46,13 @@ WashdayClient.prototype.users = {
|
|
|
44
46
|
updateUserById: put_5.updateUserById,
|
|
45
47
|
};
|
|
46
48
|
WashdayClient.prototype.countries = {
|
|
47
|
-
getCountries:
|
|
49
|
+
getCountries: get_3.getCountries,
|
|
50
|
+
};
|
|
51
|
+
WashdayClient.prototype.cashierboxes = {
|
|
52
|
+
getCashierboxesByStoreId: get_1.getCashierboxesByStoreId,
|
|
48
53
|
};
|
|
49
54
|
WashdayClient.prototype.companies = {
|
|
50
|
-
getCompanyById:
|
|
55
|
+
getCompanyById: get_2.getCompanyById,
|
|
51
56
|
updateCompanyById: put_1.updateCompanyById,
|
|
52
57
|
updateCompanyLogoById: put_1.updateCompanyLogoById,
|
|
53
58
|
updateCompanyTaxInfoById: put_1.updateCompanyTaxInfoById,
|
|
@@ -60,7 +65,8 @@ WashdayClient.prototype.stripe = {
|
|
|
60
65
|
createCustomerPortalSession: post_4.createCustomerPortalSession
|
|
61
66
|
};
|
|
62
67
|
WashdayClient.prototype.staff = {
|
|
63
|
-
getStoreStaff:
|
|
68
|
+
getStoreStaff: get_5.getStoreStaff,
|
|
69
|
+
getStoreStaffById: get_5.getStoreStaffById,
|
|
64
70
|
updateStoreStaffById: put_3.updateStoreStaffById,
|
|
65
71
|
createStoreStaff: post_2.createStoreStaff,
|
|
66
72
|
deleteStoreStaffById: delete_1.deleteStoreStaffById,
|
package/dist/api/staff/delete.js
CHANGED
|
@@ -14,13 +14,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.deleteStoreStaffById = void 0;
|
|
16
16
|
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_STAFF = (storeId) => `api/store/${storeId}/staff`;
|
|
17
18
|
const deleteStoreStaffById = function (storeId, staffId) {
|
|
18
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
20
|
try {
|
|
20
21
|
const config = {
|
|
21
22
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
22
23
|
};
|
|
23
|
-
const response = yield axiosInstance_1.default.delete(
|
|
24
|
+
const response = yield axiosInstance_1.default.delete(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
|
|
24
25
|
return response;
|
|
25
26
|
}
|
|
26
27
|
catch (error) {
|
package/dist/api/staff/get.js
CHANGED
|
@@ -12,15 +12,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getStoreStaff = void 0;
|
|
15
|
+
exports.getStoreStaffById = exports.getStoreStaff = void 0;
|
|
16
16
|
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_STAFF = (storeId) => `api/store/${storeId}/staff`;
|
|
17
18
|
const getStoreStaff = function (storeId, queryParams) {
|
|
18
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
20
|
try {
|
|
20
21
|
const config = {
|
|
21
22
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
22
23
|
};
|
|
23
|
-
const response = yield axiosInstance_1.default.get(
|
|
24
|
+
const response = yield axiosInstance_1.default.get(`${GET_SET_STAFF(storeId)}?${queryParams}`, config);
|
|
24
25
|
return response;
|
|
25
26
|
}
|
|
26
27
|
catch (error) {
|
|
@@ -30,3 +31,18 @@ const getStoreStaff = function (storeId, queryParams) {
|
|
|
30
31
|
});
|
|
31
32
|
};
|
|
32
33
|
exports.getStoreStaff = getStoreStaff;
|
|
34
|
+
const getStoreStaffById = function (storeId, staffId) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
const config = {
|
|
38
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
39
|
+
};
|
|
40
|
+
return yield axiosInstance_1.default.get(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('Error fetching getStoreStaffById:', error);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.getStoreStaffById = getStoreStaffById;
|
package/dist/api/staff/post.js
CHANGED
|
@@ -14,14 +14,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.createStoreStaff = void 0;
|
|
16
16
|
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
-
const
|
|
17
|
+
const GET_SET_STAFF = (storeId) => `api/store/${storeId}/staff`;
|
|
18
18
|
const createStoreStaff = function (storeId, data) {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
try {
|
|
21
21
|
const config = {
|
|
22
22
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
23
23
|
};
|
|
24
|
-
const response = yield axiosInstance_1.default.post(
|
|
24
|
+
const response = yield axiosInstance_1.default.post(`${GET_SET_STAFF(storeId)}`, data, config);
|
|
25
25
|
return response;
|
|
26
26
|
}
|
|
27
27
|
catch (error) {
|
package/dist/api/stores/post.js
CHANGED
|
@@ -14,11 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.createStoreImage = void 0;
|
|
16
16
|
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
-
const GET_SET_STORES = 'api/store';
|
|
18
17
|
const GET_SET_STORE_IMAGE = 'api/store-image';
|
|
19
|
-
const REQUEST_PARAMS = {
|
|
20
|
-
token: 'LOGGED_USER_TOKEN',
|
|
21
|
-
};
|
|
22
18
|
const createStoreImage = function (data) {
|
|
23
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
20
|
try {
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
// import axiosInstance from "../axiosInstance";
|
|
3
|
+
|
|
4
|
+
// export const deleteStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string): Promise<any> {
|
|
5
|
+
// try {
|
|
6
|
+
// const config = {
|
|
7
|
+
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
8
|
+
// };
|
|
9
|
+
// const response = await axiosInstance.delete(`api/store/${storeId}/staff/${staffId}`, config);
|
|
10
|
+
// return response;
|
|
11
|
+
// } catch (error) {
|
|
12
|
+
// console.error('Error fetching getStoreStaff:', error);
|
|
13
|
+
// throw error;
|
|
14
|
+
// }
|
|
15
|
+
// };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
import { IStore } from "../../interfaces/Store";
|
|
4
|
+
|
|
5
|
+
export const GET_SET_CASHIER_BOX = (storeId: string) => `api/store/${storeId}/cashierbox`;
|
|
6
|
+
|
|
7
|
+
export const getCashierboxesByStoreId = async function (this: WashdayClientInstance, storeId: string, queryParams?: string): Promise<any> {
|
|
8
|
+
try {
|
|
9
|
+
const config = {
|
|
10
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
11
|
+
};
|
|
12
|
+
const response = await axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams}`, config);
|
|
13
|
+
return response;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error('Error fetching getStoreStaff:', error);
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
// import axiosInstance from "../axiosInstance";
|
|
3
|
+
|
|
4
|
+
// const GET_SET_STORES = 'api/store';
|
|
5
|
+
|
|
6
|
+
// export const createStoreStaff = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
|
|
7
|
+
// try {
|
|
8
|
+
// const config = {
|
|
9
|
+
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
10
|
+
// };
|
|
11
|
+
// const response = await axiosInstance.post(`api/store/${storeId}/staff`, data, config);
|
|
12
|
+
// return response;
|
|
13
|
+
// } catch (error) {
|
|
14
|
+
// console.error('Error fetching createStoreImage:', error);
|
|
15
|
+
// throw error;
|
|
16
|
+
// }
|
|
17
|
+
// };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
// import { IStore } from "../../interfaces/Store";
|
|
3
|
+
// import axiosInstance from "../axiosInstance";
|
|
4
|
+
|
|
5
|
+
// export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<any> {
|
|
6
|
+
// try {
|
|
7
|
+
// const config = {
|
|
8
|
+
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
// };
|
|
10
|
+
// const response = await axiosInstance.put(`api/store/${storeId}/staff`, data, config);
|
|
11
|
+
// return response;
|
|
12
|
+
// } catch (error) {
|
|
13
|
+
// console.error('Error fetching getStoreById:', error);
|
|
14
|
+
// throw error;
|
|
15
|
+
// }
|
|
16
|
+
// };
|
package/src/api/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../interfaces/Api";
|
|
2
|
+
import { getCashierboxesByStoreId } from "./cashierbox/get";
|
|
2
3
|
import { getCompanyById } from "./companies/get";
|
|
3
4
|
import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
|
|
4
5
|
import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
|
|
@@ -6,7 +7,7 @@ import { getCountries } from "./countries/get";
|
|
|
6
7
|
import { getCustomerById, getCustomerHighlightsById } from "./customers/get";
|
|
7
8
|
import { bulkUpdate } from "./products/put";
|
|
8
9
|
import { deleteStoreStaffById } from "./staff/delete";
|
|
9
|
-
import { getStoreStaff } from "./staff/get";
|
|
10
|
+
import { getStoreStaff, getStoreStaffById } from "./staff/get";
|
|
10
11
|
import { createStoreStaff } from "./staff/post";
|
|
11
12
|
import { updateStoreStaffById } from "./staff/put";
|
|
12
13
|
import { getStoreById, getStoreReviewLink, getStores } from "./stores/get";
|
|
@@ -31,6 +32,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
31
32
|
WashdayClient.prototype.companies.apiToken = apiToken;
|
|
32
33
|
WashdayClient.prototype.stripe.apiToken = apiToken;
|
|
33
34
|
WashdayClient.prototype.staff.apiToken = apiToken;
|
|
35
|
+
WashdayClient.prototype.cashierboxes.apiToken = apiToken;
|
|
34
36
|
} as any;
|
|
35
37
|
|
|
36
38
|
WashdayClient.prototype.customers = {
|
|
@@ -59,6 +61,10 @@ WashdayClient.prototype.countries = {
|
|
|
59
61
|
getCountries: getCountries,
|
|
60
62
|
};
|
|
61
63
|
|
|
64
|
+
WashdayClient.prototype.cashierboxes = {
|
|
65
|
+
getCashierboxesByStoreId: getCashierboxesByStoreId,
|
|
66
|
+
};
|
|
67
|
+
|
|
62
68
|
WashdayClient.prototype.companies = {
|
|
63
69
|
getCompanyById: getCompanyById,
|
|
64
70
|
updateCompanyById: updateCompanyById,
|
|
@@ -76,6 +82,7 @@ WashdayClient.prototype.stripe = {
|
|
|
76
82
|
|
|
77
83
|
WashdayClient.prototype.staff = {
|
|
78
84
|
getStoreStaff: getStoreStaff,
|
|
85
|
+
getStoreStaffById: getStoreStaffById,
|
|
79
86
|
updateStoreStaffById: updateStoreStaffById,
|
|
80
87
|
createStoreStaff: createStoreStaff,
|
|
81
88
|
deleteStoreStaffById: deleteStoreStaffById,
|
package/src/api/staff/delete.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_STAFF = (storeId: string) => `api/store/${storeId}/staff`;
|
|
3
4
|
|
|
4
5
|
export const deleteStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string): Promise<any> {
|
|
5
6
|
try {
|
|
6
7
|
const config = {
|
|
7
8
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
8
9
|
};
|
|
9
|
-
const response = await axiosInstance.delete(
|
|
10
|
+
const response = await axiosInstance.delete(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
|
|
10
11
|
return response;
|
|
11
12
|
} catch (error) {
|
|
12
13
|
console.error('Error fetching getStoreStaff:', error);
|
package/src/api/staff/get.ts
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import axiosInstance from "../axiosInstance";
|
|
3
|
-
import { IStore } from "../../interfaces/Store";
|
|
4
3
|
|
|
4
|
+
const GET_SET_STAFF = (storeId: string) => `api/store/${storeId}/staff`;
|
|
5
5
|
|
|
6
6
|
export const getStoreStaff = async function (this: WashdayClientInstance, storeId: string, queryParams?: string): Promise<any> {
|
|
7
7
|
try {
|
|
8
8
|
const config = {
|
|
9
9
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
10
10
|
};
|
|
11
|
-
const response = await axiosInstance.get(
|
|
11
|
+
const response = await axiosInstance.get(`${GET_SET_STAFF(storeId)}?${queryParams}`, config);
|
|
12
12
|
return response;
|
|
13
13
|
} catch (error) {
|
|
14
14
|
console.error('Error fetching getStoreStaff:', error);
|
|
15
15
|
throw error;
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
+
|
|
19
|
+
export const getStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string): Promise<any> {
|
|
20
|
+
try {
|
|
21
|
+
const config = {
|
|
22
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
23
|
+
};
|
|
24
|
+
return await axiosInstance.get(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('Error fetching getStoreStaffById:', error);
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
};
|
package/src/api/staff/post.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import axiosInstance from "../axiosInstance";
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const GET_SET_STAFF = (storeId: string) => `api/store/${storeId}/staff`;
|
|
5
5
|
|
|
6
6
|
export const createStoreStaff = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
|
|
7
7
|
try {
|
|
8
8
|
const config = {
|
|
9
9
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
10
10
|
};
|
|
11
|
-
const response = await axiosInstance.post(
|
|
11
|
+
const response = await axiosInstance.post(`${GET_SET_STAFF(storeId)}`, data, config);
|
|
12
12
|
return response;
|
|
13
13
|
} catch (error) {
|
|
14
14
|
console.error('Error fetching createStoreImage:', error);
|
package/src/api/stores/post.ts
CHANGED
|
@@ -2,13 +2,8 @@ import { WashdayClientInstance } from "../../interfaces/Api";
|
|
|
2
2
|
import { IStore } from "../../interfaces/Store";
|
|
3
3
|
import axiosInstance from "../axiosInstance";
|
|
4
4
|
|
|
5
|
-
const GET_SET_STORES = 'api/store';
|
|
6
5
|
const GET_SET_STORE_IMAGE = 'api/store-image';
|
|
7
6
|
|
|
8
|
-
const REQUEST_PARAMS = {
|
|
9
|
-
token: 'LOGGED_USER_TOKEN',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
7
|
export const createStoreImage = async function (this: WashdayClientInstance, data: any): Promise<any> {
|
|
13
8
|
try {
|
|
14
9
|
const config = {
|