2. Implementation - PersonCentredSoftware/RelativesGateway GitHub Wiki

Initialisation

Please initialise the library into a Javascript variable at the top of each page. This code can live in a common layout template file.

<script type="text/javascript">
    PcsComponents.init({
      providerId: 'Provider_ID',
      providerURL: 'https://yourwebsite.com',
      passwordResetURL: 'https://yourwebsite.com/Home/ResetMyPassword'
    });
</script>

passwordResetURL is used to redirect the user to your website from an email, during password change process. See Password change section for more information.

Generic pattern

In majority of the cases, you will need to follow this pattern to display components

<script type="text/javascript">
    PcsComponents.getInstance().then(function (lib) {

      // The API is now accessible via the lib variable

      lib.getAccess().then(function(access){

        // access variable contains security information, which will let you know if the current user has logged in, 
        // and which components do they have access to
        // your own logic also goes here
      });
    });
</script>

Components

To display a component on a webpage, please create a container (e.g. a div) and give it an ID. You will need to pass this ID to the component load function, see further for examples.

⚠️ **GitHub.com Fallback** ⚠️