Use MustGetText to get the company’s slug
This commit is contained in:
parent
917db31227
commit
80f14d5818
|
@ -25,11 +25,7 @@ func NewRouter(db *Db) http.Handler {
|
|||
user := getUser(r)
|
||||
if user.LoggedIn {
|
||||
conn := getConn(r)
|
||||
var slug string
|
||||
err := conn.QueryRow(r.Context(), "select slug::text from company order by company_id limit 1").Scan(&slug)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
slug := conn.MustGetText(r.Context(), "", "select slug::text from company order by company_id limit 1")
|
||||
http.Redirect(w, r, "/company/"+slug, http.StatusFound)
|
||||
} else {
|
||||
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
||||
|
|
Loading…
Reference in New Issue