Skip to content

Commit

Permalink
Add authorization required decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
singhpratyush committed Jun 2, 2018
1 parent 84fae78 commit 72e2ee6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils/decorators.js
@@ -0,0 +1,6 @@
import notify from './notification';
import getStore from './storeUtils';

const notAuthorizedError = () => notify.danger('Please log in first!');

export const authRequired = target => getStore().getState().login.isLoggedIn ? target : notAuthorizedError;

0 comments on commit 72e2ee6

Please sign in to comment.