Minor fixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Server config
|
||||
MODE=development
|
||||
HOST=localhost:8000
|
||||
HOST=:8000
|
||||
|
||||
# Separate services
|
||||
GIT_URL=https://git.phc.dm.unipi.it
|
||||
@@ -9,6 +9,7 @@ CHAT_URL=https://chat.phc.dm.unipi.it
|
||||
# Other
|
||||
EMAIL=macchinisti@lists.dm.unipi.it
|
||||
|
||||
# Lista Utenti
|
||||
USER_PAGES_BASE_URL=https://poisson.phc.dm.unipi.it/~
|
||||
|
||||
# AuthService
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
{{define "title"}}Profilo di @{{ .User.Username }} • PHC{{end}}
|
||||
{{define "body"}}
|
||||
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<script src="/public/js/profilo.min.js"></script>
|
||||
<script src="/public/profilo.min.js"></script>
|
||||
<section x-data="profilo">
|
||||
<h1>Profilo di @{{ .User.Username }}</h1>
|
||||
<h1>Profilo di <strong>@{{ .User.Username }}</strong></h1>
|
||||
<p class="center">
|
||||
<a class="button" href="/logout">Logout</a>
|
||||
</p>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
{{define "body"}}
|
||||
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/fuse.js/dist/fuse.js"></script>
|
||||
<script src="/public/js/utenti.min.js"></script>
|
||||
<script src="/public/utenti.min.js"></script>
|
||||
<section x-data="utenti">
|
||||
<h1>
|
||||
<i class="fas fa-users"></i>
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
type Service interface {
|
||||
HandleStaticPage(w io.Writer, view string, ctx Context) error
|
||||
HandleUtenti() ([]*model.User, error)
|
||||
HandleListaUtenti() ([]website.UserInfo, error)
|
||||
HandleStoriaPage(w io.Writer, ctx Context) error
|
||||
HandleQueryAppunti(w io.Writer, query string, ctx Context) error
|
||||
HandleNewsPage(w io.Writer, ctx Context) error
|
||||
@@ -61,6 +62,15 @@ func (h *DefaultHandler) HandleUtenti() ([]*model.User, error) {
|
||||
return utenti, nil
|
||||
}
|
||||
|
||||
func (h *DefaultHandler) HandleListaUtenti() ([]website.UserInfo, error) {
|
||||
utenti, err := h.ListaUtenti.GetUtenti()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return utenti, nil
|
||||
}
|
||||
|
||||
func (h *DefaultHandler) HandleStoriaPage(w io.Writer, ctx Context) error {
|
||||
storia, err := h.Storia.GetStoria()
|
||||
if err != nil {
|
||||
|
||||
+5
-3
@@ -36,6 +36,7 @@ func NewFiberServer(h handler.Service) *fiber.App {
|
||||
return app
|
||||
}
|
||||
|
||||
// routes defines routes under "/"
|
||||
func routes(h handler.Service, r fiber.Router) {
|
||||
//
|
||||
// Initial setup
|
||||
@@ -152,9 +153,10 @@ func routes(h handler.Service, r fiber.Router) {
|
||||
routesApi(h, r.Group("/api"))
|
||||
}
|
||||
|
||||
// routesApi defines routes under "/api"
|
||||
func routesApi(h handler.Service, r fiber.Router) {
|
||||
r.Get("/api/utenti", func(c *fiber.Ctx) error {
|
||||
utenti, err := h.HandleUtenti()
|
||||
r.Get("/utenti", func(c *fiber.Ctx) error {
|
||||
utenti, err := h.HandleListaUtenti()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -162,7 +164,7 @@ func routesApi(h handler.Service, r fiber.Router) {
|
||||
return c.JSON(utenti)
|
||||
})
|
||||
|
||||
r.Get("/api/profilo", func(c *fiber.Ctx) error {
|
||||
r.Get("/profilo", func(c *fiber.Ctx) error {
|
||||
user, err := h.HandleRequiredUser(CreateContext(c))
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user