mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-30 08:03:55 +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