diff options
author | 2019-12-02 18:21:45 +0100 | |
---|---|---|
committer | 2019-12-02 18:21:45 +0100 | |
commit | 39629b074063f4f33d8b82c22023d7207bc431de (patch) | |
tree | 96ff288aa5f65d6ef11fc75528564d3266e594c7 /server.go | |
parent | e9d31b0940793542021b5218e406d6e0c668c185 (diff) | |
download | alps-39629b074063f4f33d8b82c22023d7207bc431de.tar.gz alps-39629b074063f4f33d8b82c22023d7207bc431de.tar.bz2 alps-39629b074063f4f33d8b82c22023d7207bc431de.zip |
Add basic message list
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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, }) }) |