aboutsummaryrefslogtreecommitdiffstats
path: root/server.go
diff options
context:
space:
mode:
authorLibravatarLibravatar Simon Ser <[email protected]> 2019-12-02 18:21:45 +0100
committerLibravatarLibravatar Simon Ser <[email protected]> 2019-12-02 18:21:45 +0100
commit39629b074063f4f33d8b82c22023d7207bc431de (patch)
tree96ff288aa5f65d6ef11fc75528564d3266e594c7 /server.go
parente9d31b0940793542021b5218e406d6e0c668c185 (diff)
downloadalps-39629b074063f4f33d8b82c22023d7207bc431de.tar.gz
alps-39629b074063f4f33d8b82c22023d7207bc431de.tar.bz2
alps-39629b074063f4f33d8b82c22023d7207bc431de.zip
Add basic message list
Diffstat (limited to 'server.go')
-rw-r--r--server.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/server.go b/server.go
index f573756..8245e08 100644
--- a/server.go
+++ b/server.go
@@ -88,7 +88,7 @@ func handleLogin(ectx echo.Context) error {
}
ctx.setToken(token)
- return ctx.Redirect(http.StatusFound, "/")
+ return ctx.Redirect(http.StatusFound, "/mailbox/INBOX")
}
return ctx.Render(http.StatusOK, "login.html", nil)
@@ -135,7 +135,7 @@ func New(imapURL string) *echo.Echo {
e.Logger.Fatal("Failed to load templates:", err)
}
- e.GET("/", func(ectx echo.Context) error {
+ e.GET("/mailbox/:mbox", func(ectx echo.Context) error {
ctx := ectx.(*context)
mailboxes, err := listMailboxes(ctx.conn)
@@ -143,8 +143,14 @@ func New(imapURL string) *echo.Echo {
return err
}
- return ctx.Render(http.StatusOK, "index.html", map[string]interface{}{
+ msgs, err := listMessages(ctx.conn, ctx.Param("mbox"))
+ if err != nil {
+ return err
+ }
+
+ return ctx.Render(http.StatusOK, "mailbox.html", map[string]interface{}{
"Mailboxes": mailboxes,
+ "Messages": msgs,
})
})