Skip to content

Commit 0fa6ec5

Browse files
committed
fix(browser): use auth mode in query string in browser
1 parent 74972a1 commit 0fa6ec5

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

packages/algoliasearch/src/builds/browser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
stopABTest,
1818
StopABTestResponse,
1919
} from '@algolia/client-analytics';
20-
import { version, WaitablePromise } from '@algolia/client-common';
20+
import { AuthMode, version, WaitablePromise } from '@algolia/client-common';
2121
import {
2222
createRecommendationClient,
2323
getPersonalizationStrategy,
@@ -201,6 +201,7 @@ export default function algoliasearch(
201201
],
202202
}),
203203
userAgent: createUserAgent(version).add({ segment: 'Browser' }),
204+
authMode: AuthMode.WithinQueryParameters,
204205
};
205206

206207
return createSearchClient({
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export const AuthMode: Readonly<Record<string, AuthModeType>> = {
1+
// @MAJOR: export this as individual constants, so it can be minified
2+
3+
export const AuthMode = {
24
/**
35
* If auth credentials should be in query parameters.
46
*/
@@ -8,6 +10,6 @@ export const AuthMode: Readonly<Record<string, AuthModeType>> = {
810
* If auth credentials should be in headers.
911
*/
1012
WithinHeaders: 1,
11-
};
13+
} as const;
1214

13-
export type AuthModeType = 0 | 1;
15+
export type AuthModeType = typeof AuthMode[keyof typeof AuthMode];

packages/transporter/src/types/CallType.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export const CallEnum: Readonly<Record<string, CallType>> = {
1+
// @MAJOR: export this as individual constants, so it can be minified
2+
3+
export const CallEnum = {
24
/**
35
* If the host is read only.
46
*/
@@ -13,6 +15,6 @@ export const CallEnum: Readonly<Record<string, CallType>> = {
1315
* If the host is both read and write.
1416
*/
1517
Any: 3,
16-
};
18+
} as const;
1719

18-
export type CallType = 1 | 2 | 3;
20+
export type CallType = typeof CallEnum[keyof typeof CallEnum];

0 commit comments

Comments
 (0)