@go-avro/avro-js 0.0.2-beta.86 → 0.0.2-beta.87

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.
@@ -77,7 +77,7 @@ export class AvroQueryClient {
77
77
  const queryClient = useQueryClient();
78
78
  return useMutation({
79
79
  mutationFn: async ({ username, password, code, cancelToken }) => {
80
- const resp = await this.post('/login', JSON.stringify({ username, password, code }), cancelToken);
80
+ const resp = await this.post('/login', JSON.stringify({ username, password, code }), cancelToken, { 'Content-Type': 'application/json' });
81
81
  if (!resp || !('access_token' in resp)) {
82
82
  if (resp.msg === "TOTP email sent") {
83
83
  return LoginResponse.NEEDS_TOTP;
@@ -164,7 +164,10 @@ export class AvroQueryClient {
164
164
  if (!companyGuid || companyGuid.trim() === '') {
165
165
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
166
166
  }
167
- return this._fetch('POST', `/company/${companyGuid}/jobs`, JSON.stringify(body), cancelToken, headers)
167
+ return this._fetch('POST', `/company/${companyGuid}/jobs`, JSON.stringify(body), cancelToken, {
168
+ ...headers,
169
+ 'Content-Type': 'application/json',
170
+ })
168
171
  .then(response => {
169
172
  if (!response || !Array.isArray(response)) {
170
173
  throw new StandardError(400, 'Invalid jobs response');
@@ -180,7 +183,10 @@ export class AvroQueryClient {
180
183
  if (!companyGuid || companyGuid.trim() === '') {
181
184
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
182
185
  }
183
- return this._fetch('POST', `/company/${companyGuid}/chats`, JSON.stringify(body), cancelToken, headers)
186
+ return this._fetch('POST', `/company/${companyGuid}/chats`, JSON.stringify(body), cancelToken, {
187
+ ...headers,
188
+ 'Content-Type': 'application/json',
189
+ })
184
190
  .then(response => {
185
191
  if (!response || !Array.isArray(response)) {
186
192
  throw new StandardError(400, 'Invalid chats response');
@@ -196,7 +202,10 @@ export class AvroQueryClient {
196
202
  if (!chatGuid || chatGuid.trim() === '') {
197
203
  return Promise.reject(new StandardError(400, 'Chat GUID is required'));
198
204
  }
199
- return this._fetch('POST', `/chat/${chatGuid}/messages`, JSON.stringify(body), cancelToken, headers)
205
+ return this._fetch('POST', `/chat/${chatGuid}/messages`, JSON.stringify(body), cancelToken, {
206
+ ...headers,
207
+ 'Content-Type': 'application/json',
208
+ })
200
209
  .then(response => {
201
210
  if (!response || !Array.isArray(response)) {
202
211
  throw new StandardError(400, 'Invalid messages response');
@@ -212,7 +221,10 @@ export class AvroQueryClient {
212
221
  if (!companyGuid || companyGuid.trim() === '') {
213
222
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
214
223
  }
215
- return this._fetch('POST', `/company/${companyGuid}/events`, JSON.stringify(body), cancelToken, headers)
224
+ return this._fetch('POST', `/company/${companyGuid}/events`, JSON.stringify(body), cancelToken, {
225
+ ...headers,
226
+ 'Content-Type': 'application/json',
227
+ })
216
228
  .then(response => {
217
229
  if (!response || !Array.isArray(response)) {
218
230
  throw new StandardError(400, 'Invalid events response');
@@ -228,7 +240,10 @@ export class AvroQueryClient {
228
240
  if (!companyGuid || companyGuid.trim() === '') {
229
241
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
230
242
  }
231
- return this._fetch('POST', `/company/${companyGuid}/months`, JSON.stringify(body), cancelToken, headers)
243
+ return this._fetch('POST', `/company/${companyGuid}/months`, JSON.stringify(body), cancelToken, {
244
+ ...headers,
245
+ 'Content-Type': 'application/json',
246
+ })
232
247
  .then(response => {
233
248
  if (!response || !Array.isArray(response)) {
234
249
  throw new StandardError(400, 'Invalid months response');
@@ -244,7 +259,10 @@ export class AvroQueryClient {
244
259
  if (!companyGuid || companyGuid.trim() === '') {
245
260
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
246
261
  }
247
- return this._fetch('POST', `/company/${companyGuid}/bills`, JSON.stringify(body), cancelToken, headers)
262
+ return this._fetch('POST', `/company/${companyGuid}/bills`, JSON.stringify(body), cancelToken, {
263
+ ...headers,
264
+ 'Content-Type': 'application/json',
265
+ })
248
266
  .then(response => {
249
267
  if (!response || !Array.isArray(response)) {
250
268
  throw new StandardError(400, 'Invalid bills response');
@@ -260,7 +278,10 @@ export class AvroQueryClient {
260
278
  if (!companyGuid || companyGuid.trim() === '') {
261
279
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
262
280
  }
263
- return this._fetch('POST', `/company/${companyGuid}/routes`, JSON.stringify(body), cancelToken, headers)
281
+ return this._fetch('POST', `/company/${companyGuid}/routes`, JSON.stringify(body), cancelToken, {
282
+ ...headers,
283
+ 'Content-Type': 'application/json',
284
+ })
264
285
  .then(response => {
265
286
  if (!response || !Array.isArray(response)) {
266
287
  throw new StandardError(400, 'Invalid routes response');
@@ -276,7 +297,10 @@ export class AvroQueryClient {
276
297
  if (!companyGuid || companyGuid.trim() === '') {
277
298
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
278
299
  }
279
- return this._fetch('POST', `/company/${companyGuid}/teams`, JSON.stringify(body), cancelToken, headers)
300
+ return this._fetch('POST', `/company/${companyGuid}/teams`, JSON.stringify(body), cancelToken, {
301
+ ...headers,
302
+ 'Content-Type': 'application/json',
303
+ })
280
304
  .then(response => {
281
305
  if (!response || !Array.isArray(response)) {
282
306
  throw new StandardError(400, 'Invalid teams response');
@@ -17,7 +17,6 @@ AvroQueryClient.prototype._fetch = async function (method, path, body, cancelTok
17
17
  checkCancelled();
18
18
  const url = this.config.baseUrl + path;
19
19
  const requestHeaders = {
20
- 'Content-Type': 'application/json',
21
20
  Authorization: `Bearer ${token}`,
22
21
  ...headers,
23
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.86",
3
+ "version": "0.0.2-beta.87",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",