// TODO func (u *User) Profile(response http.ResponseWriter, request *http.Request) { user_id, _ := utilities.GetUserId(request) db := utilities.GetDB(request) user := new(models.User) user.Get(db, user_id) user.Password = "" out, _ := json.Marshal(user) response.Write(out) }
/// TODO func (i *Index) Sitemap(w http.ResponseWriter, req *http.Request) { sitemap := SiteMap{ {"url": "#/login", "title": "Login"}, } sitemap_for_user := SiteMap{ {"url": "/auth/logout", "title": "Logout"}, {"url": "#/users/profile", "title": "Profile"}, } _, err := utilities.GetUserId(req) if err == nil { js, _ := json.Marshal(sitemap_for_user) w.Write(js) } else { js, _ := json.Marshal(sitemap) w.Write(js) } }