@functionalcms/svelte-components 0.8.8 → 0.8.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/authStore.js CHANGED
@@ -37,6 +37,9 @@ const handleToken = (token) => {
37
37
  accessToken.set(token.accessToken);
38
38
  userId.set(token.username);
39
39
  }
40
+ else {
41
+ isAuthenticated.set(false);
42
+ }
40
43
  };
41
44
  const logUsingCookies = async (config) => {
42
45
  const accounts = msal.getAllAccounts();
@@ -61,5 +64,6 @@ export const authStore = {
61
64
  },
62
65
  signOut: async () => {
63
66
  await msal.logoutPopup({});
67
+ isAuthenticated.set(false);
64
68
  },
65
69
  };
@@ -4,9 +4,10 @@ export let companyName;
4
4
  export let logoUrl;
5
5
  export let pages;
6
6
  export let authentication;
7
- let authenticationVisibility = Visiblity.NotAuthenticated;
8
- authentication.subscribe((value) => value ? Visiblity.Authenticated : Visiblity.NotAuthenticated);
9
- const selectVisible = (pages2) => pages2.filter((page) => page.visiblity === Visiblity.Always || page.visiblity === authenticationVisibility);
7
+ const selectVisible = (pages2, visiblity) => pages2.filter((page) => page.visiblity === Visiblity.Always || page.visiblity === visiblity);
8
+ authentication.subscribe((value) => visibleNavItems = selectVisible(pages, value ? Visiblity.Authenticated : Visiblity.NotAuthenticated));
9
+ $:
10
+ visibleNavItems = selectVisible(pages, Visiblity.NotAuthenticated);
10
11
  </script>
11
12
 
12
13
  <div class="header">
@@ -17,7 +18,7 @@ const selectVisible = (pages2) => pages2.filter((page) => page.visiblity === Vis
17
18
  </a>
18
19
  </div>
19
20
  <HeaderNav>
20
- {#each selectVisible(pages) as page}
21
+ {#each visibleNavItems as page}
21
22
  <HeaderNavItem>
22
23
  <a on:click={page.action} href={page.path}>
23
24
  {page.name}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "0.8.8",
3
+ "version": "0.8.10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },