configcat-js-ssr
Advanced tools
Comparing version 3.8.0 to 3.9.0
@@ -1,6 +0,6 @@ | ||
import { IConfigFetcher, ProjectConfig, OptionsBase } from "configcat-common"; | ||
import { IConfigFetcher, OptionsBase, FetchResult } from "configcat-common"; | ||
export declare class HttpConfigFetcher implements IConfigFetcher { | ||
fetchLogic(options: OptionsBase, lastProjectConfig: ProjectConfig, callback: (newProjectConfig: ProjectConfig) => void): void; | ||
fetchLogic(options: OptionsBase, lastEtag: string, callback: (result: FetchResult) => void): void; | ||
} | ||
export default IConfigFetcher; | ||
//# sourceMappingURL=ConfigFetcher.d.ts.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
} | ||
HttpConfigFetcher.prototype.fetchLogic = function (options, lastProjectConfig, callback) { | ||
HttpConfigFetcher.prototype.fetchLogic = function (options, lastEtag, callback) { | ||
var axiosConfig = { | ||
@@ -16,3 +16,3 @@ method: 'get', | ||
'X-ConfigCat-UserAgent': "ConfigCat-JS-SSR/" + options.clientVersion, | ||
'If-None-Match': (lastProjectConfig && lastProjectConfig.HttpETag) ? lastProjectConfig.HttpETag : null | ||
'If-None-Match': (lastEtag) ? lastEtag : null | ||
} | ||
@@ -24,3 +24,3 @@ }; | ||
if (response.status === 200) { | ||
callback(new configcat_common_1.ProjectConfig(new Date().getTime(), JSON.stringify(response.data), eTag)); | ||
callback(configcat_common_1.FetchResult.success(JSON.stringify(response.data), eTag)); | ||
} | ||
@@ -30,3 +30,3 @@ else { | ||
options.logger.info("Double-check your SDK Key on https://app.configcat.com/sdkkey"); | ||
callback(lastProjectConfig); | ||
callback(configcat_common_1.FetchResult.error()); | ||
} | ||
@@ -37,4 +37,3 @@ }) | ||
if (error.response.status === 304) { | ||
var eTag = error.response.headers.etag; | ||
callback(new configcat_common_1.ProjectConfig(new Date().getTime(), JSON.stringify(lastProjectConfig.ConfigJSON), eTag)); | ||
callback(configcat_common_1.FetchResult.notModified()); | ||
} | ||
@@ -44,3 +43,3 @@ else { | ||
options.logger.info("Double-check your SDK Key on https://app.configcat.com/sdkkey"); | ||
callback(lastProjectConfig); | ||
callback(configcat_common_1.FetchResult.error()); | ||
} | ||
@@ -50,7 +49,7 @@ } | ||
options.logger.error('The request to Configcat was made but no response was received'); | ||
callback(lastProjectConfig); | ||
callback(configcat_common_1.FetchResult.error()); | ||
} | ||
else { | ||
options.logger.error("Something happened in setting up the request to ConfigCat: " + error.message); | ||
callback(lastProjectConfig); | ||
callback(configcat_common_1.FetchResult.error()); | ||
} | ||
@@ -57,0 +56,0 @@ }); |
{ | ||
"name": "configcat-js-ssr", | ||
"version": "3.8.0", | ||
"version": "3.9.0", | ||
"description": "ConfigCat Feature Flags for Server Side Rendered apps like NuxtJS. Official ConfigCat SDK for Server Side Rendered to easily access feature flags.", | ||
@@ -43,3 +43,3 @@ "main": "lib/index.js", | ||
"axios": "^0.25.0", | ||
"configcat-common": "^4.6.2" | ||
"configcat-common": "^5.0.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104770
192
+ Addedconfigcat-common@5.3.0(transitive)
- Removedconfigcat-common@4.6.2(transitive)
Updatedconfigcat-common@^5.0.1