-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_accounts.go
More file actions
40 lines (34 loc) · 936 Bytes
/
view_accounts.go
File metadata and controls
40 lines (34 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"github.com/go-chi/chi/v5"
"net/http"
)
func (app *App) handleAccountsView(w http.ResponseWriter, r *http.Request) {
data := struct {
Title string
CurrentPage string
}{
Title: "Accounts - Obsrvr Intelligence Console",
CurrentPage: "accounts",
}
if err := app.templates.ExecuteTemplate(w, "accounts.html", data); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
func (app *App) handleAccountView(w http.ResponseWriter, r *http.Request) {
accountID := chi.URLParam(r, "id")
data := struct {
Title string
CurrentPage string
AccountID string
}{
Title: "Account " + accountID + " - Obsrvr Intelligence Console",
CurrentPage: "accounts",
AccountID: accountID,
}
if err := app.templates.ExecuteTemplate(w, "account.html", data); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}