fix post generate
This commit is contained in:
@@ -41,13 +41,25 @@ export function mountHeader(
|
||||
currentHandle: string,
|
||||
isLoggedIn: boolean,
|
||||
userHandle: string | undefined,
|
||||
callbacks: HeaderCallbacks
|
||||
callbacks: HeaderCallbacks,
|
||||
isStatic: boolean = false
|
||||
): void {
|
||||
container.innerHTML = renderHeader(currentHandle, isLoggedIn, userHandle)
|
||||
// For static pages, only update if login state requires it
|
||||
const existingLoginBtn = container.querySelector('#login-btn')
|
||||
const existingUserBtn = container.querySelector('#user-btn')
|
||||
const needsUpdate = !isStatic ||
|
||||
(isLoggedIn && existingLoginBtn) || // Need to show user button
|
||||
(!isLoggedIn && existingUserBtn) // Need to show login button
|
||||
|
||||
if (needsUpdate) {
|
||||
container.innerHTML = renderHeader(currentHandle, isLoggedIn, userHandle)
|
||||
}
|
||||
|
||||
const form = document.getElementById('header-form') as HTMLFormElement
|
||||
const input = document.getElementById('header-input') as HTMLInputElement
|
||||
|
||||
if (!form) return
|
||||
|
||||
form.addEventListener('submit', (e) => {
|
||||
e.preventDefault()
|
||||
const handle = input.value.trim()
|
||||
|
||||
Reference in New Issue
Block a user