Skip to content

Commit e6f7198

Browse files
committed
Corrected formatting
1 parent 54706cd commit e6f7198

File tree

1 file changed

+20
-28
lines changed

1 file changed

+20
-28
lines changed

packages/database/src/core/ReadonlyRestClient.ts

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import {
19-
assert,
20-
safeGet,
21-
} from '@firebase/util';
18+
import { assert, safeGet } from '@firebase/util';
2219

2320
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
2421
import { AuthTokenProvider } from './AuthTokenProvider';
@@ -53,7 +50,7 @@ export class ReadonlyRestClient extends ServerActions {
5350
} else {
5451
assert(
5552
query._queryParams.isDefault(),
56-
'should have a tag if it\'s not a default query.'
53+
"should have a tag if it's not a default query."
5754
);
5855
return query._path.toString();
5956
}
@@ -98,7 +95,7 @@ export class ReadonlyRestClient extends ServerActions {
9895

9996
let [response, data] = await this.restRequest_(
10097
pathString + '.json',
101-
queryStringParameters,
98+
queryStringParameters
10299
);
103100

104101
let error = response.status;
@@ -144,19 +141,14 @@ export class ReadonlyRestClient extends ServerActions {
144141
queryStringParameters
145142
);
146143

147-
if (response.status === 404) {
148-
data = null;
149-
} else if (!response.ok) {
150-
throw new Error(data as string);
151-
}
144+
if (response.status === 404) {
145+
data = null;
146+
} else if (!response.ok) {
147+
throw new Error(data as string);
148+
}
152149

153-
this.onDataUpdate_(
154-
pathString,
155-
data,
156-
/*isMerge=*/ false,
157-
/*tag=*/ null
158-
);
159-
return data as string;
150+
this.onDataUpdate_(pathString, data, /*isMerge=*/ false, /*tag=*/ null);
151+
return data as string;
160152
}
161153

162154
/** @inheritDoc */
@@ -170,22 +162,23 @@ export class ReadonlyRestClient extends ServerActions {
170162
*/
171163
private async restRequest_<T = unknown>(
172164
pathString: string,
173-
queryStringParameters: Record<string, string | number> = {},
165+
queryStringParameters: Record<string, string | number> = {}
174166
): Promise<[Response, T | null]> {
175-
176167
// Fetch tokens
177168
const [authToken, appCheckToken] = await Promise.all([
178169
this.authTokenProvider_.getToken(/*forceRefresh=*/ false),
179170
this.appCheckTokenProvider_.getToken(/*forceRefresh=*/ false)
180171
]);
181172

182173
// Configure URL parameters
183-
const searchParams = new URLSearchParams(queryStringParameters as Record<string, string>);
174+
const searchParams = new URLSearchParams(
175+
queryStringParameters as Record<string, string>
176+
);
184177
if (authToken && authToken.accessToken) {
185178
searchParams.set('auth', authToken.accessToken);
186179
}
187180
if (appCheckToken && appCheckToken.token) {
188-
searchParams.set("ac", appCheckToken.token);
181+
searchParams.set('ac', appCheckToken.token);
189182
}
190183
searchParams.set('format', 'export');
191184
searchParams.set('ns', this.repoInfo_.namespace);
@@ -202,21 +195,20 @@ export class ReadonlyRestClient extends ServerActions {
202195
const response = await fetch(url);
203196
if (!response.ok) {
204197
// Request was not successful, so throw an error
205-
throw new Error(`REST request at ${url} returned error: ${response.status}`);
198+
throw new Error(
199+
`REST request at ${url} returned error: ${response.status}`
200+
);
206201
}
207202

208203
this.log_(
209204
'REST Response for ' + url + ' received. status:',
210-
response.status,
205+
response.status
211206
);
212207
let result: T | null = null;
213208
try {
214209
result = await response.json();
215210
} catch (e) {
216-
warn(
217-
'Failed to parse server response as json.',
218-
e
219-
);
211+
warn('Failed to parse server response as json.', e);
220212
}
221213

222214
return [response, result];

0 commit comments

Comments
 (0)