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)
|
user := getUser(r)
|
||||||
if user.LoggedIn {
|
if user.LoggedIn {
|
||||||
conn := getConn(r)
|
conn := getConn(r)
|
||||||
var slug string
|
slug := conn.MustGetText(r.Context(), "", "select slug::text from company order by company_id limit 1")
|
||||||
err := conn.QueryRow(r.Context(), "select slug::text from company order by company_id limit 1").Scan(&slug)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
http.Redirect(w, r, "/company/"+slug, http.StatusFound)
|
http.Redirect(w, r, "/company/"+slug, http.StatusFound)
|
||||||
} else {
|
} else {
|
||||||
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
||||||
|
|
Loading…
Reference in New Issue