aboutsummaryrefslogtreecommitdiff
path: root/src/client/js
diff options
context:
space:
mode:
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();
});