washday-sdk 0.0.167 → 0.0.169
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/axiosInstance.js +2 -2
- package/dist/api/index.js +1 -0
- package/dist/api/routes/post.js +14 -0
- package/package.json +1 -1
- package/src/api/axiosInstance.ts +2 -2
- package/src/api/index.ts +1 -0
- package/src/api/routes/post.ts +13 -0
- package/src/interfaces/Api.ts +1 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
// Define the type for the Axios instance
|
|
3
3
|
let axiosInstance = null;
|
|
4
|
-
const BASE_URL = 'http://localhost:5555/';
|
|
5
|
-
|
|
4
|
+
// const BASE_URL: string = 'http://localhost:5555/';
|
|
5
|
+
const BASE_URL = 'https://washday-backend.herokuapp.com/';
|
|
6
6
|
// Function to create or return the singleton instance
|
|
7
7
|
const getAxiosInstance = () => {
|
|
8
8
|
if (!axiosInstance) {
|
package/dist/api/index.js
CHANGED
|
@@ -81,6 +81,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
81
81
|
closeRouteById: routesEndpoints.putModule.closeRouteById,
|
|
82
82
|
updateRouteById: routesEndpoints.putModule.updateRouteById,
|
|
83
83
|
getRoutesByDriver: routesEndpoints.getModule.getRoutesByDriver,
|
|
84
|
+
startRoute: routesEndpoints.postModule.startRoute,
|
|
84
85
|
});
|
|
85
86
|
this.auth = bindMethods(this, {
|
|
86
87
|
customerLoginToken: authEndpoints.postModule.customerLoginToken,
|
package/dist/api/routes/post.js
CHANGED
|
@@ -51,3 +51,17 @@ export const createRouteV2 = function (data) {
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
|
+
export const startRoute = function (routeId) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
try {
|
|
57
|
+
const config = {
|
|
58
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
59
|
+
};
|
|
60
|
+
return yield axiosInstance.post(`${GET_SET_ROUTES}/${routeId}/start`, {}, config);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error('Error fetching startRoute:', error);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
package/package.json
CHANGED
package/src/api/axiosInstance.ts
CHANGED
|
@@ -3,8 +3,8 @@ import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
|
3
3
|
// Define the type for the Axios instance
|
|
4
4
|
let axiosInstance: AxiosInstance | null = null;
|
|
5
5
|
|
|
6
|
-
const BASE_URL: string = 'http://localhost:5555/';
|
|
7
|
-
|
|
6
|
+
// const BASE_URL: string = 'http://localhost:5555/';
|
|
7
|
+
const BASE_URL: string = 'https://washday-backend.herokuapp.com/';
|
|
8
8
|
|
|
9
9
|
// Function to create or return the singleton instance
|
|
10
10
|
const getAxiosInstance = (): AxiosInstance => {
|
package/src/api/index.ts
CHANGED
|
@@ -88,6 +88,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
88
88
|
closeRouteById: routesEndpoints.putModule.closeRouteById,
|
|
89
89
|
updateRouteById: routesEndpoints.putModule.updateRouteById,
|
|
90
90
|
getRoutesByDriver: routesEndpoints.getModule.getRoutesByDriver,
|
|
91
|
+
startRoute: routesEndpoints.postModule.startRoute,
|
|
91
92
|
});
|
|
92
93
|
this.auth = bindMethods(this, {
|
|
93
94
|
customerLoginToken: authEndpoints.postModule.customerLoginToken,
|
package/src/api/routes/post.ts
CHANGED
|
@@ -44,4 +44,17 @@ export const createRouteV2 = async function (this: WashdayClientInstance, data:
|
|
|
44
44
|
console.error('Error fetching createRouteV2:', error);
|
|
45
45
|
throw error;
|
|
46
46
|
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
export const startRoute = async function (this: WashdayClientInstance, routeId: string): Promise<any> {
|
|
51
|
+
try {
|
|
52
|
+
const config = {
|
|
53
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
54
|
+
};
|
|
55
|
+
return await axiosInstance.post(`${GET_SET_ROUTES}/${routeId}/start`, {}, config);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error('Error fetching startRoute:', error);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
47
60
|
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -88,6 +88,7 @@ export interface WashdayClientInstance {
|
|
|
88
88
|
closeRouteById: typeof routesEndpoints.putModule.closeRouteById,
|
|
89
89
|
updateRouteById: typeof routesEndpoints.putModule.updateRouteById,
|
|
90
90
|
getRoutesByDriver: typeof routesEndpoints.getModule.getRoutesByDriver,
|
|
91
|
+
startRoute: typeof routesEndpoints.postModule.startRoute,
|
|
91
92
|
},
|
|
92
93
|
orders: {
|
|
93
94
|
getList: typeof ordersEndpoints.getModule.getList;
|