add recipe viewer

This commit is contained in:
Kenta420 2024-02-21 15:17:54 +07:00
parent 92b11f7b9d
commit f7f1535695
31 changed files with 1532 additions and 151 deletions

View file

@ -193,12 +193,19 @@ func (ar *AuthRouter) Route(r chi.Router) {
json.NewEncoder(w).Encode(value)
})
r.Post("/refresh", func(w http.ResponseWriter, r *http.Request) {
r.Get("/refresh", func(w http.ResponseWriter, r *http.Request) {
refreshToken := r.Header.Get("X-Refresh-Token")
if refreshToken == "" {
http.Error(w, "Refresh token not found", http.StatusUnauthorized)
return
cookie, err := r.Cookie("refresh_token")
if err != nil {
http.Error(w, "Refresh token not found", http.StatusUnauthorized)
return
} else {
refreshToken = cookie.Value
}
}
// exchange refresh token for new token