diff --git a/src/lib/common/ProfileDropdown.svelte b/src/lib/common/ProfileDropdown.svelte index ea549dd0..9abac5e0 100644 --- a/src/lib/common/ProfileDropdown.svelte +++ b/src/lib/common/ProfileDropdown.svelte @@ -2,7 +2,10 @@ import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from '@sveltestrap/sveltestrap'; import { goto } from '$app/navigation'; import { browser } from '$app/environment'; - + /** + * @type {{ full_name: any; }} + */ + export let user; function logout() { if (browser){ localStorage.removeItem('authUser'); @@ -19,7 +22,7 @@ id="page-header-user-dropdown" > Header Avatar - Henry + {user?.full_name} diff --git a/src/lib/helpers/store.js b/src/lib/helpers/store.js index 8e299654..98862f68 100644 --- a/src/lib/helpers/store.js +++ b/src/lib/helpers/store.js @@ -2,7 +2,7 @@ import { writable } from 'svelte/store'; import { browser } from '$app/environment'; /** @type {Writable} */ -export const userStore = writable({ id: "" }); +export const userStore = writable({ id: "", full_name: "" }); /** * @returns {Writable} diff --git a/src/lib/services/auth-service.js b/src/lib/services/auth-service.js index 67ce405c..6da6e67f 100644 --- a/src/lib/services/auth-service.js +++ b/src/lib/services/auth-service.js @@ -47,6 +47,7 @@ export async function myInfo() { const response = await axios.get(endpoints.myInfoUrl); let user = getUserStore(); user.id = response.data.id; + user.full_name = response.data.full_name; userStore.set(user); return response.data; } diff --git a/src/routes/VerticalLayout/Header.svelte b/src/routes/VerticalLayout/Header.svelte index f7b1f7a7..e6bb9ad2 100644 --- a/src/routes/VerticalLayout/Header.svelte +++ b/src/routes/VerticalLayout/Header.svelte @@ -8,6 +8,10 @@ import ProfileDropdown from '$lib/common/ProfileDropdown.svelte'; import { OverlayScrollbars } from 'overlayscrollbars'; import { PUBLIC_LOGO_URL } from '$env/static/public'; + /** + * @type {any} + */ + export let user; const toggleSideBar = () => { if (browser) { @@ -83,7 +87,7 @@ - + diff --git a/src/routes/VerticalLayout/Index.svelte b/src/routes/VerticalLayout/Index.svelte index 73c7ef66..b3444652 100644 --- a/src/routes/VerticalLayout/Index.svelte +++ b/src/routes/VerticalLayout/Index.svelte @@ -6,9 +6,14 @@ import Footer from './Footer.svelte'; import { onMount } from 'svelte'; import { getPluginMenu } from '$lib/services/plugin-service'; + import { myInfo } from '$lib/services/auth-service'; /** @type {import('$types').PluginMenuDefModel[]} */ let menu; + /** + * @type {import("$types").UserModel} + */ + let user; const toggleRightBar = () => { if (browser) { @@ -26,6 +31,7 @@ onMount(async () => { menu = await getPluginMenu(); + user = await myInfo(); if (browser) { document.body.setAttribute('data-layout', 'vertical'); } @@ -33,7 +39,7 @@
-
+
{#if menu} {/if} diff --git a/src/routes/page/dashboard/+page.svelte b/src/routes/page/dashboard/+page.svelte index d8b5f6c4..a369035e 100644 --- a/src/routes/page/dashboard/+page.svelte +++ b/src/routes/page/dashboard/+page.svelte @@ -25,13 +25,16 @@ PUBLIC_BRAND_NAME } from '$env/static/public'; import { onMount } from 'svelte'; + import { getUserStore } from '$lib/helpers/store'; let subscribemodal = false; + let user = {full_name: ""}; const togglesubscribemodal = (() => { subscribemodal = !subscribemodal; }) onMount(() => { + user = getUserStore(); setTimeout(() => { subscribemodal = true; }, 1000); @@ -64,7 +67,7 @@
-
Henry Price
+
{user?.full_name}

Agent Manager