-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_assets.go
More file actions
41 lines (35 loc) · 931 Bytes
/
view_assets.go
File metadata and controls
41 lines (35 loc) · 931 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
40
package main
import (
"github.com/go-chi/chi/v5"
"net/http"
)
func (app *App) handleAssetsView(w http.ResponseWriter, r *http.Request) {
data := struct {
Title string
CurrentPage string
}{
Title: "Assets - Obsrvr Intelligence Console",
CurrentPage: "assets",
}
if err := app.templates.ExecuteTemplate(w, "assets.html", data); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
func (app *App) handleAssetView(w http.ResponseWriter, r *http.Request) {
code := chi.URLParam(r, "code")
issuer := chi.URLParam(r, "issuer")
data := struct {
Title string
AssetCode string
Issuer string
}{
Title: "Asset " + code + " - Obsrvr Intelligence Console",
AssetCode: code,
Issuer: issuer,
}
if err := app.templates.ExecuteTemplate(w, "assets.html", data); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}