Skip to content

Commit ed8027d

Browse files
committed
Make response data not optional
1 parent 67e9446 commit ed8027d

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/client/eppo-precomputed-client.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,8 @@ export default class EppoPrecomputedClient {
144144

145145
// A callback to capture the salt and subject information
146146
precomputedRequestor.onPrecomputedResponse = (responseData) => {
147-
if (responseData.salt) {
148-
this.setDecodedFlagKeySalt(decodeBase64(responseData.salt));
149-
}
150-
if (responseData.subjectKey && responseData.subjectAttributes) {
151-
this.setSubjectData(responseData.subjectKey, responseData.subjectAttributes);
152-
}
147+
this.setDecodedFlagKeySalt(decodeBase64(responseData.salt));
148+
this.setSubjectData(responseData.subjectKey, responseData.subjectAttributes);
153149
};
154150

155151
const pollingCallback = async () => {

src/precomputed-requestor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { PrecomputedFlag, UNKNOWN_ENVIRONMENT_NAME } from './interfaces';
55
import { Attributes } from './types';
66

77
export interface PrecomputedResponseData {
8-
salt?: string;
9-
subjectKey?: string;
10-
subjectAttributes?: Attributes;
8+
salt: string;
9+
subjectKey: string;
10+
subjectAttributes: Attributes;
1111
}
1212

1313
// Requests AND stores precomputed flags, reuses the configuration store
@@ -27,9 +27,9 @@ export default class PrecomputedFlagRequestor {
2727
subject_attributes: this.subjectAttributes,
2828
});
2929

30-
if (this.onPrecomputedResponse) {
30+
if (this.onPrecomputedResponse && precomputedResponse) {
3131
this.onPrecomputedResponse({
32-
salt: precomputedResponse?.salt,
32+
salt: precomputedResponse.salt,
3333
subjectKey: this.subjectKey,
3434
subjectAttributes: this.subjectAttributes,
3535
});

0 commit comments

Comments
 (0)