diff options
author | Joris | 2016-01-01 14:39:40 +0100 |
---|---|---|
committer | Joris | 2016-01-01 14:39:40 +0100 |
commit | 0d0c99fd28b782c7daf02fb5cc48d3eb252e705d (patch) | |
tree | 93f9836152b6db9fc7a7af34ceb1dde920b1f3c3 /src/client/js | |
parent | 5f3d75406ef36924616e3289342647f4939d5004 (diff) |
Simplify persona usage
Diffstat (limited to 'src/client/js')
-rw-r--r-- | src/client/js/main.js | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/client/js/main.js b/src/client/js/main.js index 12593e6..5fd73ea 100644 --- a/src/client/js/main.js +++ b/src/client/js/main.js @@ -5,24 +5,16 @@ var app = Elm.fullscreen(Elm.Main, { sign: null }); -navigator.id.watch({ - loggedInUser: null, - onlogin: function(assertion) { - app.ports.sign.send({ - operation: 'SignIn', - assertion: assertion - }); - }, - onlogout: function() {} -}); - -app.ports.persona.subscribe(function(communication) { - if(communication === 'SignIn') { - navigator.id.request(); - } else if(communication === 'SignOut') { - navigator.id.logout(); - app.ports.sign.send({ - operation: 'SignOut' - }); - } +app.ports.persona.subscribe(function() { + navigator.id.watch({ + loggedInUser: null, + onlogin: function(assertion) { + app.ports.sign.send({ + operation: 'SignIn', + assertion: assertion + }); + }, + onlogout: function() {} + }); + navigator.id.request(); }); |