From dae48c0ded3d35ccc4e802bd22fdb278e76a574a Mon Sep 17 00:00:00 2001 From: Kevin Ramharak Date: Wed, 3 Jan 2018 06:00:17 +0100 Subject: [PATCH] implements #20 with #fd2ef569b36f98c00ee7e9953f0041d6dff30316 fixes #20 --- mar/phaser/mar.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mar/phaser/mar.js b/mar/phaser/mar.js index fc453ea..406ff2e 100644 --- a/mar/phaser/mar.js +++ b/mar/phaser/mar.js @@ -803,16 +803,16 @@ function codeListener(message) { * Listens for authentications responses from the server */ function authListener(message) { - - if (message.t === "auth") { - - if (message.m === "ok") { - console.log("Auth successful"); - mar.client.requestUserInfo(); - - } else { - alert("Authentication failed. Please make sure you are logged in and reload the page."); + if (message.t === "code") { + var code = message.code; + if(typeof window.localStorage !== 'undefined') { // localStorage is supported + var value = window.localStorage.getItem("editorCodeContents"); + // if item does not exist null is returned + if(value !== null) { + code = value; + } } + ace.edit("editor").setValue(code); } }