Add an /api/authcheck and use it to toggle logout/login link on top header.

This commit is contained in:
Zed A. Shaw 2025-09-17 11:33:22 -04:00
parent c2123ff741
commit fcb71add03
3 changed files with 15 additions and 2 deletions

View file

@ -15,6 +15,12 @@ import (
. "MY/webapp/common"
)
func GetApiAuthCheck(c *fiber.Ctx) error {
_, err := CheckAuthed(c, false)
// auth failure or not authed is determined by err, with nil meaning YES AUTHED
return c.JSON(fiber.Map{"is_authed": err == nil})
}
func GetApiLogout(c *fiber.Ctx) error {
err := LogoutUser(c)
if err != nil { return IfErrNil(err, c) }