diff --git a/ghost/sdk/layer2/README.md b/ghost/sdk/layer2/README.md index 02a0de0b58..077582d6ea 100644 --- a/ghost/sdk/layer2/README.md +++ b/ghost/sdk/layer2/README.md @@ -13,12 +13,16 @@ or ### As a drop in script: -This will attack a `Members` object to the window, with a `getToken` method. +This will automatically hide and show the elements with `data-members-signin` and `data-members-signout` attributes. -It will automatically hide and show the elements with `data-members-signin` and `data-members-signout` attributes +It will set a js cookie called `member` with the token, on the `/` path and keep it in sync with the state of the users loggedin status +It will also reload the page on login/logout, so you are able to read the cookie serverside, and do any content rendering there. ```html + ``` ### As a library @@ -26,18 +30,20 @@ It will automatically hide and show the elements with `data-members-signin` and ```html ``` +#### Or with a module loader + ```javascript const Members = require('@tryghost/members-layer2'); Members.init(); // Sets up binding the elements to the login/logout state -Members.getToken(); +fetch('/ghost/api/v2/content/posts/', { credentials: 'same-origin' }); ```