|
| 1 | +/* eslint-disable no-var */ |
1 | 2 | import axios, { CancelToken } from 'axios' |
2 | 3 | import { AccessToken } from '../models/AccessToken' |
3 | 4 | import Configuration from '../Configuration' |
4 | 5 | import { ApiRole } from '../models/ApiRole' |
5 | | -import serialize from '../utils/ParamsSerializer' |
| 6 | +import paramsSerializer from '../utils/ParamsSerializer' |
6 | 7 | import { RequiredDeep } from '../models/RequiredDeep' |
7 | 8 | import OrderCloudError from '../utils/OrderCloudError' |
8 | 9 |
|
@@ -65,13 +66,17 @@ class Auth { |
65 | 66 | } |
66 | 67 | const configuration = Configuration.Get() |
67 | 68 | const response = await axios |
68 | | - .post(`${configuration.baseApiUrl}/oauth/token`, serialize(body), { |
69 | | - headers: { |
70 | | - 'Content-Type': 'application/x-www-form-urlencoded', |
71 | | - Accept: 'application/json', |
72 | | - }, |
73 | | - ...requestOptions, |
74 | | - }) |
| 69 | + .post( |
| 70 | + `${configuration.baseApiUrl}/oauth/token`, |
| 71 | + paramsSerializer.serialize(body), |
| 72 | + { |
| 73 | + headers: { |
| 74 | + 'Content-Type': 'application/x-www-form-urlencoded', |
| 75 | + Accept: 'application/json', |
| 76 | + }, |
| 77 | + ...requestOptions, |
| 78 | + } |
| 79 | + ) |
75 | 80 | .catch(e => { |
76 | 81 | if (e.response) { |
77 | 82 | throw new OrderCloudError(e) |
@@ -126,13 +131,17 @@ class Auth { |
126 | 131 | } |
127 | 132 | const configuration = Configuration.Get() |
128 | 133 | const response = await axios |
129 | | - .post(`${configuration.baseApiUrl}/oauth/token`, serialize(body), { |
130 | | - headers: { |
131 | | - 'Content-Type': 'application/x-www-form-urlencoded', |
132 | | - Accept: 'application/json', |
133 | | - }, |
134 | | - ...requestOptions, |
135 | | - }) |
| 134 | + .post( |
| 135 | + `${configuration.baseApiUrl}/oauth/token`, |
| 136 | + paramsSerializer.serialize(body), |
| 137 | + { |
| 138 | + headers: { |
| 139 | + 'Content-Type': 'application/x-www-form-urlencoded', |
| 140 | + Accept: 'application/json', |
| 141 | + }, |
| 142 | + ...requestOptions, |
| 143 | + } |
| 144 | + ) |
136 | 145 | .catch(e => { |
137 | 146 | if (e.response) { |
138 | 147 | throw new OrderCloudError(e) |
@@ -181,13 +190,17 @@ class Auth { |
181 | 190 | } |
182 | 191 | const configuration = Configuration.Get() |
183 | 192 | const response = await axios |
184 | | - .post(`${configuration.baseApiUrl}/oauth/token`, serialize(body), { |
185 | | - headers: { |
186 | | - 'Content-Type': 'application/x-www-form-urlencoded', |
187 | | - Accept: 'application/json', |
188 | | - }, |
189 | | - ...requestOptions, |
190 | | - }) |
| 193 | + .post( |
| 194 | + `${configuration.baseApiUrl}/oauth/token`, |
| 195 | + paramsSerializer.serialize(body), |
| 196 | + { |
| 197 | + headers: { |
| 198 | + 'Content-Type': 'application/x-www-form-urlencoded', |
| 199 | + Accept: 'application/json', |
| 200 | + }, |
| 201 | + ...requestOptions, |
| 202 | + } |
| 203 | + ) |
191 | 204 | .catch(e => { |
192 | 205 | if (e.response) { |
193 | 206 | throw new OrderCloudError(e) |
@@ -220,13 +233,17 @@ class Auth { |
220 | 233 | } |
221 | 234 | const configuration = Configuration.Get() |
222 | 235 | const response = await axios |
223 | | - .post(`${configuration.baseApiUrl}/oauth/token`, serialize(body), { |
224 | | - headers: { |
225 | | - 'Content-Type': 'application/x-www-form-urlencoded', |
226 | | - Accept: 'application/json', |
227 | | - }, |
228 | | - ...requestOptions, |
229 | | - }) |
| 236 | + .post( |
| 237 | + `${configuration.baseApiUrl}/oauth/token`, |
| 238 | + paramsSerializer.serialize(body), |
| 239 | + { |
| 240 | + headers: { |
| 241 | + 'Content-Type': 'application/x-www-form-urlencoded', |
| 242 | + Accept: 'application/json', |
| 243 | + }, |
| 244 | + ...requestOptions, |
| 245 | + } |
| 246 | + ) |
230 | 247 | .catch(e => { |
231 | 248 | if (e.response) { |
232 | 249 | throw new OrderCloudError(e) |
@@ -270,13 +287,17 @@ class Auth { |
270 | 287 | } |
271 | 288 | const configuration = Configuration.Get() |
272 | 289 | const response = await axios |
273 | | - .post(`${configuration.baseApiUrl}/oauth/token`, serialize(body), { |
274 | | - headers: { |
275 | | - 'Content-Type': 'application/x-www-form-urlencoded', |
276 | | - Accept: 'application/json', |
277 | | - }, |
278 | | - ...requestOptions, |
279 | | - }) |
| 290 | + .post( |
| 291 | + `${configuration.baseApiUrl}/oauth/token`, |
| 292 | + paramsSerializer.serialize(body), |
| 293 | + { |
| 294 | + headers: { |
| 295 | + 'Content-Type': 'application/x-www-form-urlencoded', |
| 296 | + Accept: 'application/json', |
| 297 | + }, |
| 298 | + ...requestOptions, |
| 299 | + } |
| 300 | + ) |
280 | 301 | .catch(e => { |
281 | 302 | if (e.response) { |
282 | 303 | throw new OrderCloudError(e) |
|
0 commit comments