diff --git a/docs/api/client/hoodie.rst b/docs/api/client/hoodie.rst index eb501a3fc..988ded432 100644 --- a/docs/api/client/hoodie.rst +++ b/docs/api/client/hoodie.rst @@ -14,15 +14,16 @@ Initialisation -------------- The Hoodie Client persists state in the browser, like the current user’s -id, session or the connection status to the backend. On page load, -Hoodie has to load this state from the local store before you can use -its APIs. You can use the Promise returned by ``hoodie.ready`` to wait -until all APIs are fully initialised +id, session or the connection status to the backend. .. code:: js - hoodie.ready.then(function () { - // all hoodie APIs are ready now + hoodie.account.get('session').then(function (session) { + if (session) { + // user is signed in + } else { + // user is signed out + } }) This is work in progress diff --git a/public/account/client.js b/public/account/client.js index 7af97143e..e76d8523c 100644 --- a/public/account/client.js +++ b/public/account/client.js @@ -81,9 +81,9 @@ document.querySelector('body').addEventListener('click', function (event) { } }) -hoodie.ready.then(function () { +hoodie.account.get('session').then(function (session) { // Client Rendering Logic - if (hoodie.account.isSignedIn()) { + if (session) { document.querySelector('.generic-loader-wrap').setAttribute('data-hide', 'true') document.querySelectorAll('.profile-forms').forEach(function (node) { return node.setAttribute('data-hide', 'false')