Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sahat committed Jul 19, 2016
2 parents 0948eb7 + 13c8f1e commit d9c80ff
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Project Logo](https://lh6.googleusercontent.com/-YmfKZZLZKL0/U-KVPFSbiOI/AAAAAAAAEZA/maoYT8iJCnA/w1089-h513-no/sshot-1.png)
![Project Logo](http://i.imgur.com/yutNy7x.jpg)

# [Satellizer](https://github.com/sahat/satellizer/)

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"main": "dist/satellizer.js",
"homepage": "https://github.com/sahat/satellizer",
"dependencies": {
"angular": ">=1.3.x && <= 1.5.x"
"angular": "1.3.x - 1.5.x"
}
}
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class Config {
display: 'popup',
oauthType: '2.0',
popupOptions: { width: 452, height: 633 },
state: () => { encodeURIComponent(Math.random().toString(36).substr(2)); }
state: () => encodeURIComponent(Math.random().toString(36).substr(2))
},
github: {
name: 'github',
Expand Down
2 changes: 1 addition & 1 deletion src/oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export default class OAuth2 {
Object.assign(this.defaults, options);

this.$timeout(() => {
const url = [this.defaults.authorizationEndpoint, this.buildQueryString()].join('?');
const stateName = this.defaults.name + '_state';
const { name, state, popupOptions, redirectUri, responseType } = this.defaults;

Expand All @@ -79,6 +78,7 @@ export default class OAuth2 {
} else if (typeof state === 'string') {
this.SatellizerStorage.set(stateName, state);
}
const url = [this.defaults.authorizationEndpoint, this.buildQueryString()].join('?');

this.SatellizerPopup.open(url, name, popupOptions);

Expand Down
7 changes: 3 additions & 4 deletions src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,27 @@ export default class Storage {
constructor(private $window: angular.IHttpService,
private SatellizerConfig: Config) {
this.memoryStore = {};
this.storageType = SatellizerConfig.storageType;
}

get(key: string): string {
try {
return this.$window[this.storageType].getItem(key);
return this.$window[this.SatellizerConfig.storageType].getItem(key);
} catch (e) {
return this.memoryStore[key];
}
}

set(key: string, value: string): void {
try {
this.$window[this.storageType].setItem(key, value);
this.$window[this.SatellizerConfig.storageType].setItem(key, value);
} catch (e) {
this.memoryStore[key] = value;
}
}

remove(key: string): void {
try {
this.$window[this.storageType].removeItem(key);
this.$window[this.SatellizerConfig.storageType].removeItem(key);
} catch (e) {
delete this.memoryStore[key];
}
Expand Down

0 comments on commit d9c80ff

Please sign in to comment.