aboutsummaryrefslogtreecommitdiff
path: root/src/client/js
diff options
context:
space:
mode:
authorJoris2016-01-01 14:39:40 +0100
committerJoris2016-01-01 14:39:40 +0100
commit0d0c99fd28b782c7daf02fb5cc48d3eb252e705d (patch)
tree93f9836152b6db9fc7a7af34ceb1dde920b1f3c3 /src/client/js
parent5f3d75406ef36924616e3289342647f4939d5004 (diff)
Simplify persona usage
Diffstat (limited to 'src/client/js')
-rw-r--r--src/client/js/main.js32
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();
});