Move the /profile under the company router

This is not necessary per se, but it makes my life easier because that
way i know which company the user was when she went to its profile and
can “return” back in the menu and future nav items.
This commit is contained in:
jordi fita mas 2023-01-29 14:22:28 +01:00
parent 666935b54c
commit 1712a81dfc
2 changed files with 2 additions and 2 deletions

View File

@ -9,6 +9,7 @@ func NewRouter(db *Db) http.Handler {
companyRouter.Handle("/tax-details", CompanyTaxDetailsHandler()) companyRouter.Handle("/tax-details", CompanyTaxDetailsHandler())
companyRouter.Handle("/tax/", CompanyTaxHandler()) companyRouter.Handle("/tax/", CompanyTaxHandler())
companyRouter.Handle("/tax", CompanyTaxHandler()) companyRouter.Handle("/tax", CompanyTaxHandler())
companyRouter.Handle("/profile", ProfileHandler())
companyRouter.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { companyRouter.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
mustRenderAppTemplate(w, r, "dashboard.html", nil) mustRenderAppTemplate(w, r, "dashboard.html", nil)
}) })
@ -17,7 +18,6 @@ func NewRouter(db *Db) http.Handler {
router.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("web/static")))) router.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("web/static"))))
router.Handle("/login", LoginHandler()) router.Handle("/login", LoginHandler())
router.Handle("/logout", Authenticated(LogoutHandler())) router.Handle("/logout", Authenticated(LogoutHandler()))
router.Handle("/profile", Authenticated(ProfileHandler()))
router.Handle("/company/", Authenticated(http.StripPrefix("/company/", CompanyHandler(companyRouter)))) router.Handle("/company/", Authenticated(http.StripPrefix("/company/", CompanyHandler(companyRouter))))
router.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { router.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
user := getUser(r) user := getUser(r)

View File

@ -15,7 +15,7 @@
</summary> </summary>
<ul role="menu"> <ul role="menu">
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="/profile"> <a role="menuitem" href="{{ companyURI "/profile" }}">
<i class="ri-account-circle-line"></i> <i class="ri-account-circle-line"></i>
{{( pgettext "Account" "menu" )}} {{( pgettext "Account" "menu" )}}
</a> </a>