Login workflow (#137)

* Use collection label instead of name on the CollectionPage

* Added Avatar and logout menu item

* [feat](login) Added userpic with a logout action in the dropdown.

- Display logged in user in the AppHeader
- Implemented logout action and store + tests
- Better styles for GitHub sign in screen

Closes #100

* Better styles for the AppHeader
This commit is contained in:
Andrey Okonetchnikov
2016-11-01 14:35:20 +01:00
committed by Cássio Souza
parent 1c4751f479
commit 4d696f2253
9 changed files with 129 additions and 22 deletions

View File

@ -16,6 +16,10 @@ class LocalStorageAuthStore {
store(userData) {
window.localStorage.setItem(this.storageKey, JSON.stringify(userData));
}
logout() {
window.localStorage.removeItem(this.storageKey);
}
}
const slugFormatter = (template, entryData) => {
@ -67,6 +71,14 @@ class Backend {
});
}
logout() {
if (this.authStore) {
this.authStore.logout();
} else {
throw new Error('User isn\'t authenticated.');
}
}
listEntries(collection) {
const collectionModel = new Collection(collection);
const listMethod = this.implementation[collectionModel.listMethod()];