mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-29 15:44:26 +00:00
Implement authHooks module
This commit is contained in:
parent
a0c743d771
commit
8bdd3b697a
10
lib/hooks/auth.coffee
Normal file
10
lib/hooks/auth.coffee
Normal file
@ -0,0 +1,10 @@
|
||||
auth = require('../auth/auth')
|
||||
messages = require('../messages/messages')
|
||||
|
||||
exports.failIfNotLoggedIn = (fn) ->
|
||||
return ->
|
||||
auth.isLoggedIn (isLoggedIn) ->
|
||||
if not isLoggedIn
|
||||
throw new Error(messages.errors.loginRequired)
|
||||
|
||||
fn.apply(null, arguments)
|
Loading…
x
Reference in New Issue
Block a user