@cpzxrobot/sdk 1.2.87 → 1.2.89
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/device_gateway.ts +1 -1
- package/dist/device_gateway.js +1 -1
- package/dist/index.js +1 -0
- package/index.ts +1 -0
- package/package.json +1 -1
package/device_gateway.ts
CHANGED
|
@@ -213,7 +213,7 @@ export class DeviceGateway extends Object {
|
|
|
213
213
|
fn: any,
|
|
214
214
|
) {
|
|
215
215
|
var axios = await this.context.ready;
|
|
216
|
-
return axios.getAsSse(`/api/
|
|
216
|
+
return axios.getAsSse(`/api/v1/device/watch/${id}`, fn)
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
private getFilter<T extends { id: number }>(
|
package/dist/device_gateway.js
CHANGED
|
@@ -161,7 +161,7 @@ class DeviceGateway extends Object {
|
|
|
161
161
|
}
|
|
162
162
|
async watch(id, fn) {
|
|
163
163
|
var axios = await this.context.ready;
|
|
164
|
-
return axios.getAsSse(`/api/
|
|
164
|
+
return axios.getAsSse(`/api/v1/device/watch/${id}`, fn);
|
|
165
165
|
}
|
|
166
166
|
getFilter(type, cls) {
|
|
167
167
|
// 如果filters中已经有对应type的过滤器,则直接返回该过滤器
|
package/dist/index.js
CHANGED
|
@@ -102,6 +102,7 @@ class Cpzxrobot {
|
|
|
102
102
|
const fetchWithAuth = async (input, init) => {
|
|
103
103
|
const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
|
|
104
104
|
headers.set('Authorization', this.token);
|
|
105
|
+
headers.set('Miniapp-Code', this.appCode);
|
|
105
106
|
const response = await fetch(baseURL + input.toString(), Object.assign(Object.assign({}, init), { headers }));
|
|
106
107
|
if (!response.ok) {
|
|
107
108
|
throw new Error(`HTTP error! status: ${response.status}`);
|
package/index.ts
CHANGED
|
@@ -118,6 +118,7 @@ export class Cpzxrobot {
|
|
|
118
118
|
const fetchWithAuth = async (input: RequestInfo, init?: RequestInit) => {
|
|
119
119
|
const headers = new Headers(init?.headers);
|
|
120
120
|
headers.set('Authorization', this.token);
|
|
121
|
+
headers.set('Miniapp-Code', this.appCode);
|
|
121
122
|
const response = await fetch(baseURL + input.toString(), {
|
|
122
123
|
...init,
|
|
123
124
|
headers
|