angular-apollo
Advanced tools
Comparing version 1.3.0 to 1.3.1
export default function provideApollo(apolloOptions?: ApolloOptions): any[]; | ||
export declare function attachTokenStoreEvents(tokenStore: any): void; | ||
export interface ApolloOptions { | ||
@@ -3,0 +4,0 @@ useTokenStore?: (...args) => any; |
@@ -10,3 +10,3 @@ "use strict"; | ||
var defaultOptions = { | ||
useTokenStore: defaultTokenStore, | ||
useTokenStore: provideDefaultTokenStore, | ||
baseUrl: 'https://preprod-cdiscount.snowite.fr' | ||
@@ -41,3 +41,11 @@ }; | ||
exports.default = provideApollo; | ||
function defaultTokenStore() { | ||
function attachTokenStoreEvents(tokenStore) { | ||
tokenStore.events.subscribe(function (event) { | ||
if (event.hasBeenRefreshed) { | ||
tokenStore.save(event.authToken, event.refreshToken); | ||
} | ||
}, function (error) { return tokenStore.clear(); }); | ||
} | ||
exports.attachTokenStoreEvents = attachTokenStoreEvents; | ||
function provideDefaultTokenStore() { | ||
return { | ||
@@ -47,9 +55,3 @@ provide: token_store_1.TokenStore, | ||
var tokenStore = new token_store_1.TokenStore(); | ||
tokenStore.events.subscribe(function (event) { | ||
if (event.hasBeenRefreshed) { | ||
tokenStore.save(event.auth_token, event.refresh_token); | ||
} | ||
}, function (error) { | ||
tokenStore.clear(); | ||
}); | ||
attachTokenStoreEvents(tokenStore); | ||
return tokenStore; | ||
@@ -56,0 +58,0 @@ } |
{ | ||
"name": "angular-apollo", | ||
"description": "An API client for the 7digital Apollo platform built for Angular 2 projects.", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/7digital/angular-apollo.git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
111674
1462