washday-sdk 1.0.1 → 1.1.0
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/README.md +126 -0
- package/babel.config.js +8 -0
- package/dist/api/attendance/delete.js +2 -0
- package/dist/api/attendance/get.js +83 -0
- package/dist/api/attendance/index.js +4 -0
- package/dist/api/attendance/post.js +39 -0
- package/dist/api/attendance/put.js +25 -0
- package/dist/api/auth/index.js +3 -0
- package/dist/api/auth/post.js +170 -0
- package/dist/api/axiosInstance.js +46 -0
- package/dist/api/cashierbox/delete.js +40 -0
- package/dist/api/cashierbox/get.js +63 -0
- package/dist/api/cashierbox/post.js +42 -0
- package/dist/api/cashierbox/put.js +42 -0
- package/dist/api/cashups/delete.js +25 -0
- package/dist/api/cashups/get.js +60 -0
- package/dist/api/cashups/index.js +4 -0
- package/dist/api/cashups/post.js +25 -0
- package/dist/api/cashups/put.js +52 -0
- package/dist/api/cfdi/delete.js +25 -0
- package/dist/api/cfdi/get.js +126 -0
- package/dist/api/cfdi/index.js +4 -0
- package/dist/api/cfdi/post.js +41 -0
- package/dist/api/cfdi/put.js +52 -0
- package/dist/api/companies/get.js +29 -0
- package/dist/api/companies/post.js +41 -0
- package/dist/api/companies/put.js +57 -0
- package/dist/api/countries/get.js +29 -0
- package/dist/api/countries/post.js +1 -0
- package/dist/api/countries/put.js +1 -0
- package/dist/api/csv/get.js +325 -0
- package/dist/api/csv/index.js +1 -0
- package/dist/api/customers/delete.js +40 -0
- package/dist/api/customers/get.js +106 -0
- package/dist/api/customers/index.js +4 -0
- package/dist/api/customers/post.js +41 -0
- package/dist/api/customers/put.js +52 -0
- package/dist/api/discounts/get.js +120 -0
- package/dist/api/discounts/post.js +40 -0
- package/dist/api/discounts/put.js +68 -0
- package/dist/api/index.js +319 -0
- package/dist/api/inventory/delete.js +26 -0
- package/dist/api/inventory/get.js +62 -0
- package/dist/api/inventory/index.js +4 -0
- package/dist/api/inventory/post.js +26 -0
- package/dist/api/inventory/put.js +41 -0
- package/dist/api/order/delete.js +40 -0
- package/dist/api/order/get.js +181 -0
- package/dist/api/order/index.js +4 -0
- package/dist/api/order/post.js +115 -0
- package/dist/api/order/put.js +202 -0
- package/dist/api/outsourcedOrders/delete.js +25 -0
- package/dist/api/outsourcedOrders/get.js +62 -0
- package/dist/api/outsourcedOrders/index.js +4 -0
- package/dist/api/outsourcedOrders/post.js +25 -0
- package/dist/api/outsourcedOrders/put.js +25 -0
- package/dist/api/partners/delete.js +25 -0
- package/dist/api/partners/get.js +40 -0
- package/dist/api/partners/index.js +4 -0
- package/dist/api/partners/post.js +25 -0
- package/dist/api/partners/put.js +25 -0
- package/dist/api/pdf/get.js +43 -0
- package/dist/api/pdf/index.js +1 -0
- package/dist/api/products/delete.js +40 -0
- package/dist/api/products/get.js +25 -0
- package/dist/api/products/index.js +4 -0
- package/dist/api/products/post.js +60 -0
- package/dist/api/products/put.js +40 -0
- package/dist/api/publics/get.js +26 -0
- package/dist/api/publics/index.js +1 -0
- package/dist/api/reports/get.js +303 -0
- package/dist/api/reports/index.js +1 -0
- package/dist/api/reviews/delete.js +15 -0
- package/dist/api/reviews/get.js +41 -0
- package/dist/api/reviews/index.js +4 -0
- package/dist/api/reviews/post.js +20 -0
- package/dist/api/reviews/put.js +52 -0
- package/dist/api/routes/delete.js +25 -0
- package/dist/api/routes/get.js +95 -0
- package/dist/api/routes/index.js +4 -0
- package/dist/api/routes/post.js +67 -0
- package/dist/api/routes/put.js +54 -0
- package/dist/api/sections/delete.js +25 -0
- package/dist/api/sections/get.js +71 -0
- package/dist/api/sections/index.js +4 -0
- package/dist/api/sections/post.js +26 -0
- package/dist/api/sections/put.js +25 -0
- package/dist/api/staff/delete.js +26 -0
- package/dist/api/staff/get.js +40 -0
- package/dist/api/staff/post.js +26 -0
- package/dist/api/staff/put.js +26 -0
- package/dist/api/stores/get.js +110 -0
- package/dist/api/stores/post.js +61 -0
- package/dist/api/stores/put.js +44 -0
- package/dist/api/stripe/get.js +1 -0
- package/dist/api/stripe/post.js +71 -0
- package/dist/api/stripe/put.js +1 -0
- package/dist/api/supplies/delete.js +26 -0
- package/dist/api/supplies/get.js +62 -0
- package/dist/api/supplies/post.js +26 -0
- package/dist/api/supplies/put.js +41 -0
- package/dist/api/users/delete.js +26 -0
- package/dist/api/users/post.js +25 -0
- package/dist/api/users/put.js +29 -0
- package/dist/enum/index.js +12 -7
- package/dist/index.js +3 -28
- package/dist/interfaces/Api.js +1 -0
- package/dist/interfaces/Apple.js +16 -0
- package/dist/interfaces/Attendance.js +1 -0
- package/dist/interfaces/Customer.js +1 -2
- package/dist/interfaces/Order.js +1 -2
- package/dist/interfaces/Permission.js +1 -2
- package/dist/interfaces/Product.js +1 -2
- package/dist/interfaces/Section.js +1 -2
- package/dist/interfaces/Store.js +1 -2
- package/dist/interfaces/StoreImage.js +1 -2
- package/dist/interfaces/User.js +1 -2
- package/dist/utils/apiUtils.js +9 -0
- package/dist/utils/index.js +2 -17
- package/dist/utils/orders/calculateOrderTotal.js +30 -21
- package/dist/utils/orders/calculateTotalTaxesIncluded.js +55 -29
- package/dist/utils/orders/calculateTotalTaxesOverPrice.js +56 -45
- package/dist/utils/orders/helpers.js +126 -17
- package/dist/utils/orders/index.js +3 -5
- package/dist/utils/receipt/generateReceiptHTML.js +157 -0
- package/dist/utils/util.js +63 -0
- package/docs/README.md +66 -0
- package/docs/examples/common-use-cases.md +487 -0
- package/docs/getting-started.md +237 -0
- package/docs/modules/attendance.md +404 -0
- package/jest.config.js +0 -0
- package/package.json +12 -4
- package/src/api/attendance/delete.ts +1 -0
- package/src/api/attendance/get.ts +81 -0
- package/src/api/attendance/index.ts +4 -0
- package/src/api/attendance/post.ts +37 -0
- package/src/api/attendance/put.ts +20 -0
- package/src/api/auth/index.ts +3 -0
- package/src/api/auth/post.ts +198 -0
- package/src/api/axiosInstance.ts +13 -3
- package/src/api/cashierbox/delete.ts +28 -0
- package/src/api/cashierbox/get.ts +53 -0
- package/src/api/cashierbox/post.ts +39 -0
- package/src/api/cashierbox/put.ts +32 -0
- package/src/api/cashups/delete.ts +15 -0
- package/src/api/cashups/get.ts +52 -0
- package/src/api/cashups/index.ts +4 -0
- package/src/api/cashups/post.ts +23 -0
- package/src/api/cashups/put.ts +53 -0
- package/src/api/cfdi/delete.ts +21 -0
- package/src/api/cfdi/get.ts +119 -0
- package/src/api/cfdi/index.ts +4 -0
- package/src/api/cfdi/post.ts +60 -0
- package/src/api/cfdi/put.ts +53 -0
- package/src/api/companies/get.ts +23 -0
- package/src/api/companies/post.ts +29 -0
- package/src/api/companies/put.ts +43 -0
- package/src/api/countries/get.ts +23 -0
- package/src/api/countries/post.ts +0 -0
- package/src/api/countries/put.ts +0 -0
- package/src/api/csv/get.ts +354 -0
- package/src/api/csv/index.ts +1 -0
- package/src/api/customers/delete.ts +29 -0
- package/src/api/customers/get.ts +83 -12
- package/src/api/customers/index.ts +4 -0
- package/src/api/customers/post.ts +48 -0
- package/src/api/customers/put.ts +68 -0
- package/src/api/discounts/get.ts +100 -0
- package/src/api/discounts/post.ts +35 -0
- package/src/api/discounts/put.ts +66 -0
- package/src/api/index.ts +320 -12
- package/src/api/inventory/delete.ts +16 -0
- package/src/api/inventory/get.ts +53 -0
- package/src/api/inventory/index.ts +4 -0
- package/src/api/inventory/post.ts +22 -0
- package/src/api/inventory/put.ts +35 -0
- package/src/api/order/delete.ts +29 -0
- package/src/api/order/get.ts +207 -0
- package/src/api/order/index.ts +4 -0
- package/src/api/order/post.ts +118 -0
- package/src/api/order/put.ts +224 -0
- package/src/api/outsourcedOrders/delete.ts +15 -0
- package/src/api/outsourcedOrders/get.ts +54 -0
- package/src/api/outsourcedOrders/index.ts +4 -0
- package/src/api/outsourcedOrders/post.ts +24 -0
- package/src/api/outsourcedOrders/put.ts +21 -0
- package/src/api/partners/delete.ts +15 -0
- package/src/api/partners/get.ts +28 -0
- package/src/api/partners/index.ts +4 -0
- package/src/api/partners/post.ts +21 -0
- package/src/api/partners/put.ts +21 -0
- package/src/api/pdf/get.ts +43 -0
- package/src/api/pdf/index.ts +1 -0
- package/src/api/products/delete.ts +28 -0
- package/src/api/products/get.ts +16 -0
- package/src/api/products/index.ts +4 -0
- package/src/api/products/post.ts +73 -0
- package/src/api/products/put.ts +49 -0
- package/src/api/publics/get.ts +16 -0
- package/src/api/publics/index.ts +1 -0
- package/src/api/reports/get.ts +329 -0
- package/src/api/reports/index.ts +1 -0
- package/src/api/reviews/delete.ts +15 -0
- package/src/api/reviews/get.ts +31 -0
- package/src/api/reviews/index.ts +4 -0
- package/src/api/reviews/post.ts +20 -0
- package/src/api/reviews/put.ts +53 -0
- package/src/api/routes/delete.ts +15 -0
- package/src/api/routes/get.ts +86 -0
- package/src/api/routes/index.ts +4 -0
- package/src/api/routes/post.ts +60 -0
- package/src/api/routes/put.ts +44 -0
- package/src/api/sections/delete.ts +15 -0
- package/src/api/sections/get.ts +67 -0
- package/src/api/sections/index.ts +4 -0
- package/src/api/sections/post.ts +22 -0
- package/src/api/sections/put.ts +23 -0
- package/src/api/staff/delete.ts +16 -0
- package/src/api/staff/get.ts +29 -0
- package/src/api/staff/post.ts +17 -0
- package/src/api/staff/put.ts +17 -0
- package/src/api/stores/get.ts +93 -0
- package/src/api/stores/post.ts +49 -0
- package/src/api/stores/put.ts +35 -0
- package/src/api/stripe/get.ts +0 -0
- package/src/api/stripe/post.ts +59 -0
- package/src/api/stripe/put.ts +0 -0
- package/src/api/supplies/delete.ts +16 -0
- package/src/api/supplies/get.ts +53 -0
- package/src/api/supplies/post.ts +26 -0
- package/src/api/supplies/put.ts +33 -0
- package/src/api/users/delete.ts +16 -0
- package/src/api/users/post.ts +18 -0
- package/src/api/users/put.ts +36 -0
- package/src/enum/index.ts +9 -1
- package/src/index.ts +1 -4
- package/src/interfaces/Api.ts +308 -0
- package/src/interfaces/Apple.ts +74 -0
- package/src/interfaces/Attendance.ts +45 -0
- package/src/interfaces/Customer.ts +15 -11
- package/src/interfaces/Order.ts +38 -1
- package/src/interfaces/Product.ts +1 -0
- package/src/interfaces/Store.ts +41 -0
- package/src/utils/apiUtils.ts +11 -0
- package/src/utils/index.ts +6 -1
- package/src/utils/orders/calculateOrderTotal.test.js +930 -0
- package/src/utils/orders/calculateOrderTotal.ts +60 -15
- package/src/utils/orders/calculateTotalTaxesIncluded.ts +57 -25
- package/src/utils/orders/calculateTotalTaxesOverPrice.ts +57 -41
- package/src/utils/orders/helpers.ts +195 -47
- package/src/utils/orders/index.ts +3 -1
- package/src/utils/receipt/generateReceiptHTML.ts +163 -0
- package/src/utils/util.ts +65 -0
- package/tsconfig.json +13 -9
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# 🌀 Washday SDK
|
|
2
|
+
|
|
3
|
+
Official JavaScript/TypeScript SDK for the Washday API. Provides easy-to-use methods for integrating Washday's laundry management platform into your applications.
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start
|
|
6
|
+
|
|
7
|
+
### Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install washday-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Basic Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { WashdayClient } from 'washday-sdk';
|
|
17
|
+
|
|
18
|
+
// Initialize the client
|
|
19
|
+
const client = new WashdayClient('your-api-token');
|
|
20
|
+
|
|
21
|
+
// Example: Clock in an employee
|
|
22
|
+
await client.attendance.clockIn({
|
|
23
|
+
storeId: 'store-id',
|
|
24
|
+
notes: 'Starting shift'
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Example: Get orders
|
|
28
|
+
const orders = await client.orders.getList({
|
|
29
|
+
storeId: 'store-id',
|
|
30
|
+
status: 'pending'
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Example: Create a customer
|
|
34
|
+
const customer = await client.customers.create({
|
|
35
|
+
name: 'John Doe',
|
|
36
|
+
email: 'john@example.com',
|
|
37
|
+
phone: '+1234567890'
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 📚 Documentation
|
|
42
|
+
|
|
43
|
+
**For complete documentation, examples, and API reference, visit:**
|
|
44
|
+
|
|
45
|
+
### [📖 **docs/README.md**](./docs/README.md)
|
|
46
|
+
|
|
47
|
+
The documentation includes:
|
|
48
|
+
|
|
49
|
+
- **🚀 Getting Started** - Installation, authentication, setup
|
|
50
|
+
- **🔧 API Modules** - Complete reference for all modules (attendance, orders, customers, etc.)
|
|
51
|
+
- **📋 Examples** - Common use cases and patterns
|
|
52
|
+
- **🎯 TypeScript** - Full type definitions and interfaces
|
|
53
|
+
|
|
54
|
+
### Popular Modules
|
|
55
|
+
|
|
56
|
+
- [**Attendance**](./docs/modules/attendance.md) - Employee time tracking
|
|
57
|
+
- [**Orders**](./docs/modules/orders.md) - Order management
|
|
58
|
+
- [**Customers**](./docs/modules/customers.md) - Customer data
|
|
59
|
+
- [**Stores**](./docs/modules/stores.md) - Store configuration
|
|
60
|
+
|
|
61
|
+
## 🏗️ Architecture
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
washday-sdk/
|
|
65
|
+
├── src/
|
|
66
|
+
│ ├── api/ # API endpoint modules
|
|
67
|
+
│ ├── interfaces/ # TypeScript interfaces
|
|
68
|
+
│ └── utils/ # Utility functions
|
|
69
|
+
├── docs/ # 📚 Complete documentation
|
|
70
|
+
│ ├── modules/ # Module-specific guides
|
|
71
|
+
│ └── examples/ # Code examples
|
|
72
|
+
└── dist/ # Compiled JavaScript
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 🔑 Authentication
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// Using API token (recommended)
|
|
79
|
+
const client = new WashdayClient('your-api-token');
|
|
80
|
+
|
|
81
|
+
// The token will be automatically included in all requests
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 🛠️ Development
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Install dependencies
|
|
88
|
+
npm install
|
|
89
|
+
|
|
90
|
+
# Build the SDK
|
|
91
|
+
npm run build
|
|
92
|
+
|
|
93
|
+
# Run tests
|
|
94
|
+
npm test
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 📋 Available Modules
|
|
98
|
+
|
|
99
|
+
| Module | Description | Documentation |
|
|
100
|
+
|--------|-------------|---------------|
|
|
101
|
+
| **attendance** | Employee time tracking | [📖 Guide](./docs/modules/attendance.md) |
|
|
102
|
+
| **orders** | Order management | [📖 Guide](./docs/modules/orders.md) |
|
|
103
|
+
| **customers** | Customer data | [📖 Guide](./docs/modules/customers.md) |
|
|
104
|
+
| **products** | Product catalog | [📖 Guide](./docs/modules/products.md) |
|
|
105
|
+
| **stores** | Store settings | [📖 Guide](./docs/modules/stores.md) |
|
|
106
|
+
| **staff** | Staff management | [📖 Guide](./docs/modules/staff.md) |
|
|
107
|
+
| **inventory** | Stock management | [📖 Guide](./docs/modules/inventory.md) |
|
|
108
|
+
| **reports** | Analytics & reports | [📖 Guide](./docs/modules/reports.md) |
|
|
109
|
+
| **cashups** | Cash register | [📖 Guide](./docs/modules/cashups.md) |
|
|
110
|
+
|
|
111
|
+
[**See all modules →**](./docs/README.md#api-modules)
|
|
112
|
+
|
|
113
|
+
## 🆕 What's New
|
|
114
|
+
|
|
115
|
+
- **v1.1.0**: ✨ Added Attendance module with clock-in/out functionality
|
|
116
|
+
- **v1.0.2**: 🔧 Enhanced order management features
|
|
117
|
+
|
|
118
|
+
## 🤝 Support
|
|
119
|
+
|
|
120
|
+
- 📖 **Documentation**: [docs/README.md](./docs/README.md)
|
|
121
|
+
- 🐛 **Issues**: Create an issue in the repository
|
|
122
|
+
- 💬 **Questions**: Contact the development team
|
|
123
|
+
|
|
124
|
+
## 📄 License
|
|
125
|
+
|
|
126
|
+
ISC License - see LICENSE file for details.
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const ATTENDANCE_API = 'api/attendance';
|
|
12
|
+
export const getHistory = function (params) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
let queryParams = '';
|
|
19
|
+
if (params.storeId)
|
|
20
|
+
queryParams += `storeId=${params.storeId}&`;
|
|
21
|
+
if (params.startDate)
|
|
22
|
+
queryParams += `startDate=${params.startDate}&`;
|
|
23
|
+
if (params.endDate)
|
|
24
|
+
queryParams += `endDate=${params.endDate}&`;
|
|
25
|
+
if (params.pageNum)
|
|
26
|
+
queryParams += `pageNum=${params.pageNum}&`;
|
|
27
|
+
if (params.limit)
|
|
28
|
+
queryParams += `limit=${params.limit}&`;
|
|
29
|
+
// Remove trailing '&'
|
|
30
|
+
queryParams = queryParams.slice(0, -1);
|
|
31
|
+
const url = queryParams ? `${ATTENDANCE_API}/history?${queryParams}` : `${ATTENDANCE_API}/history`;
|
|
32
|
+
return yield axiosInstance.get(url, config);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.error('Error fetching attendance history:', error);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
export const getStatus = function (params) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
const config = {
|
|
44
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
45
|
+
};
|
|
46
|
+
let queryParams = '';
|
|
47
|
+
if (params === null || params === void 0 ? void 0 : params.storeId)
|
|
48
|
+
queryParams += `storeId=${params.storeId}`;
|
|
49
|
+
const url = queryParams ? `${ATTENDANCE_API}/status?${queryParams}` : `${ATTENDANCE_API}/status`;
|
|
50
|
+
return yield axiosInstance.get(url, config);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error('Error fetching attendance status:', error);
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
export const getStoreReport = function (storeId, params) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
try {
|
|
61
|
+
const config = {
|
|
62
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
63
|
+
};
|
|
64
|
+
let queryParams = '';
|
|
65
|
+
if (params === null || params === void 0 ? void 0 : params.startDate)
|
|
66
|
+
queryParams += `startDate=${params.startDate}&`;
|
|
67
|
+
if (params === null || params === void 0 ? void 0 : params.endDate)
|
|
68
|
+
queryParams += `endDate=${params.endDate}&`;
|
|
69
|
+
if (params === null || params === void 0 ? void 0 : params.pageNum)
|
|
70
|
+
queryParams += `pageNum=${params.pageNum}&`;
|
|
71
|
+
if (params === null || params === void 0 ? void 0 : params.limit)
|
|
72
|
+
queryParams += `limit=${params.limit}&`;
|
|
73
|
+
// Remove trailing '&'
|
|
74
|
+
queryParams = queryParams.slice(0, -1);
|
|
75
|
+
const url = queryParams ? `${ATTENDANCE_API}/store/${storeId}/report?${queryParams}` : `${ATTENDANCE_API}/store/${storeId}/report`;
|
|
76
|
+
return yield axiosInstance.get(url, config);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
console.error('Error fetching store attendance report:', error);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const ATTENDANCE_API = 'api/attendance';
|
|
12
|
+
export const clockIn = function (data) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
return yield axiosInstance.post(`${ATTENDANCE_API}/clock-in`, data, config);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error clock-in:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export const clockOut = function (data) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
try {
|
|
29
|
+
const config = {
|
|
30
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
31
|
+
};
|
|
32
|
+
return yield axiosInstance.post(`${ATTENDANCE_API}/clock-out`, data, config);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.error('Error clock-out:', error);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const ATTENDANCE_API = 'api/attendance';
|
|
12
|
+
export const updateById = function (id, data) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
return yield axiosInstance.put(`${ATTENDANCE_API}/${id}`, data, config);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Error updating attendance entry:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const CUSTOMERSAPP_GET_AUTH = "api/v2/washdayapp/auth";
|
|
12
|
+
const REGULAR_USER_AUTH = "api/auth";
|
|
13
|
+
export const customerLoginToken = function (params) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const config = {};
|
|
17
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/tokenLogin`, params, config);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Error fetching customerLoginToken:', error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const appleLogin = function (params) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
try {
|
|
28
|
+
const config = {};
|
|
29
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/apple`, params, config);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error('Error fetching appleLogin:', error);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export const facebookLogin = function (params) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
try {
|
|
40
|
+
const config = {};
|
|
41
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/facebook`, params, config);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('Error fetching facebookLogin:', error);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export const customerRegularLogin = function (params) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
try {
|
|
52
|
+
const config = {};
|
|
53
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/login`, params, config);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.error('Error fetching customerRegularLogin:', error);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
export const customerSignUp = function (params) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
try {
|
|
64
|
+
const config = {};
|
|
65
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/signUp`, params, config);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error('Error fetching customerSignUp:', error);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
export const googleLogin = function (params) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
try {
|
|
76
|
+
const config = {};
|
|
77
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/google`, params, config);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error('Error fetching googleLogin:', error);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
export const regularUserLogin = function (params) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
try {
|
|
88
|
+
const config = {};
|
|
89
|
+
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/login`, params, config);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.error('Error fetching regularUserLogin:', error);
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
export const companySignUp = function (params) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
try {
|
|
100
|
+
const config = {};
|
|
101
|
+
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/register`, params, config);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error('Error fetching companySignUp:', error);
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
export const regularUserTokenLogin = function (params) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
try {
|
|
112
|
+
const config = {};
|
|
113
|
+
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/tokenLogin`, params, config);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('Error fetching regularUserTokenLogin:', error);
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
export const forgotPassword = function (params) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
try {
|
|
124
|
+
const config = {};
|
|
125
|
+
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/forget-password`, params, config);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
console.error('Error fetching forgotPassword:', error);
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
export const customersAppForgotPassword = function (companyId, params) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
try {
|
|
136
|
+
const config = {};
|
|
137
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/${companyId}/forget-password`, params, config);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
console.error('Error fetching customersAppForgotPassword:', error);
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
export const customersAppChangePassword = function (params) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
try {
|
|
148
|
+
const config = {};
|
|
149
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/change-password`, params, config);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
console.error('Error fetching customerSignUp:', error);
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
export const pinLogin = function (data) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
try {
|
|
160
|
+
const config = {
|
|
161
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
162
|
+
};
|
|
163
|
+
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/pin-login`, data, config);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
console.error('Error fetching pinLogin:', error);
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { v4 } from 'uuid';
|
|
3
|
+
// Define the type for the Axios instance
|
|
4
|
+
let axiosInstance = null;
|
|
5
|
+
// const BASE_URL: string = 'http://localhost:5555/';
|
|
6
|
+
// const BASE_URL: string = 'https://washday-backend-development.herokuapp.com/';
|
|
7
|
+
const BASE_URL = 'https://washday-backend.herokuapp.com/';
|
|
8
|
+
// Function to create or return the singleton instance
|
|
9
|
+
const getAxiosInstance = () => {
|
|
10
|
+
if (!axiosInstance) {
|
|
11
|
+
axiosInstance = axios.create({
|
|
12
|
+
baseURL: BASE_URL,
|
|
13
|
+
headers: {
|
|
14
|
+
'Content-Type': 'application/json',
|
|
15
|
+
// Add any default headers here
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
// Add interceptor to set token and other options for every request
|
|
19
|
+
axiosInstance.interceptors.request.use((config) => {
|
|
20
|
+
const { token, responseType = 'json', contentDisposition } = config.params || {};
|
|
21
|
+
const { Authorization } = config.headers || {};
|
|
22
|
+
let contentType = config.headers['Content-Type'];
|
|
23
|
+
if (contentType === null || contentType === undefined) {
|
|
24
|
+
contentType = 'application/json';
|
|
25
|
+
}
|
|
26
|
+
if (Authorization || token) {
|
|
27
|
+
config.headers.Authorization = Authorization || `Bearer ${token}`;
|
|
28
|
+
}
|
|
29
|
+
if (contentType) {
|
|
30
|
+
config.headers['Content-Type'] = contentType;
|
|
31
|
+
}
|
|
32
|
+
if (responseType) {
|
|
33
|
+
config.responseType = responseType;
|
|
34
|
+
}
|
|
35
|
+
if (contentDisposition) {
|
|
36
|
+
config.headers['Content-Disposition'] = contentDisposition;
|
|
37
|
+
}
|
|
38
|
+
config.headers['x-request-id'] = v4(); // used to track requests in the backend
|
|
39
|
+
return config;
|
|
40
|
+
}, (error) => {
|
|
41
|
+
return Promise.reject(error);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return axiosInstance;
|
|
45
|
+
};
|
|
46
|
+
export default getAxiosInstance();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
|
|
12
|
+
const GET_SET_CASHIER_BOX_MOVEMENT = (storeId, cashierBoxId) => `/api/store/cashierbox/movement/${storeId}/${cashierBoxId}`;
|
|
13
|
+
export const deleteCashierBoxById = function (storeId, id) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const config = {
|
|
17
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
|
+
};
|
|
19
|
+
return yield axiosInstance.delete(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, config);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error('Error fetching getStoreStaff:', error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export const deleteCashierBoxMovementById = function (_a) {
|
|
28
|
+
return __awaiter(this, arguments, void 0, function* ({ storeId, cashierBoxId, movementId }) {
|
|
29
|
+
try {
|
|
30
|
+
const config = {
|
|
31
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
|
+
};
|
|
33
|
+
return yield axiosInstance.delete(`${GET_SET_CASHIER_BOX_MOVEMENT(storeId, cashierBoxId)}/${movementId}`, config);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error('Error fetching getStoreStaff:', error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
|
|
12
|
+
export const getCashierboxesByStoreId = function (storeId, queryParams) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
const response = yield axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams || ''}`, config);
|
|
19
|
+
return response;
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error('Error fetching getCashierboxesByStoreId:', error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export const getCashierboxesById = function (storeId, id, queryParams) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
try {
|
|
30
|
+
const config = {
|
|
31
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
|
+
};
|
|
33
|
+
const response = yield axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}?${queryParams}`, config);
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error('Error fetching getCashierboxesById:', error);
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export const getCashierBoxMovementsHistory = function (storeId, id, params) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
try {
|
|
45
|
+
const config = {
|
|
46
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
47
|
+
};
|
|
48
|
+
let queryParams = '';
|
|
49
|
+
if (params === null || params === void 0 ? void 0 : params.hasOwnProperty('pageNum')) {
|
|
50
|
+
queryParams += `pageNum=${params === null || params === void 0 ? void 0 : params.pageNum}`;
|
|
51
|
+
}
|
|
52
|
+
if (params === null || params === void 0 ? void 0 : params.hasOwnProperty('limit')) {
|
|
53
|
+
queryParams += `&limit=${params === null || params === void 0 ? void 0 : params.limit}`;
|
|
54
|
+
}
|
|
55
|
+
const response = yield axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}/history?${queryParams}`, config);
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.error('Error fetching getCashierBoxMovementsHistory:', error);
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
|
|
12
|
+
const GET_SET_CASHIER_BOX_MOVEMENT = (storeId, cashierBoxId) => `/api/store/cashierbox/movement/${storeId}/${cashierBoxId}`;
|
|
13
|
+
export const createCashierBox = function (storeId, data) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const config = {
|
|
17
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
|
+
};
|
|
19
|
+
const response = yield axiosInstance.post(`${GET_SET_CASHIER_BOX(storeId)}`, data, config);
|
|
20
|
+
return response;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error('Error fetching getStoreStaff:', error);
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export const addCashierBoxMovement = function (storeId, id, data) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
try {
|
|
31
|
+
const config = {
|
|
32
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
33
|
+
};
|
|
34
|
+
const response = yield axiosInstance.post(`${GET_SET_CASHIER_BOX(storeId)}/${id}/add-movement`, data, config);
|
|
35
|
+
return response;
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error('Error fetching createStoreImage:', error);
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|