Compare commits
2 Commits
ea9aceec46
...
67f1e4a26a
| Author | SHA1 | Date | |
|---|---|---|---|
| 67f1e4a26a | |||
|
|
613784a1cc |
@@ -1,11 +1,29 @@
|
||||
import { createRootRoute, Outlet } from '@tanstack/react-router'
|
||||
import { Toaster } from 'sonner'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export const Route = createRootRoute({
|
||||
component: RootLayout,
|
||||
})
|
||||
|
||||
function RootLayout() {
|
||||
useEffect(() => {
|
||||
fetch('/v1/store/branding')
|
||||
.then((r) => r.ok ? r.json() : null)
|
||||
.then((data: { name: string | null; hasLogo: boolean } | null) => {
|
||||
if (!data) return
|
||||
if (data.name) document.title = data.name
|
||||
if (data.hasLogo) {
|
||||
const link = document.querySelector<HTMLLinkElement>('link[rel="icon"]')
|
||||
?? document.createElement('link')
|
||||
link.rel = 'icon'
|
||||
link.href = '/v1/store/logo'
|
||||
document.head.appendChild(link)
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<Outlet />
|
||||
|
||||
Reference in New Issue
Block a user