remove contact us
This commit is contained in:
@@ -24,7 +24,6 @@ const (
|
||||
RandomSvgInterface = "/random-svg-interface"
|
||||
RefreshToken = "/refresh-token"
|
||||
ResetNKode = "/reset-nkode"
|
||||
ContactUs = "/contact-us"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -57,8 +56,6 @@ func (h *NKodeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
case ResetNKode:
|
||||
h.ResetNKode(w, r)
|
||||
|
||||
case ContactUs:
|
||||
h.ContactUs(w, r)
|
||||
default:
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
_, err := w.Write([]byte("404 not found"))
|
||||
@@ -344,41 +341,6 @@ func (h *NKodeHandler) ResetNKode(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
func (h *NKodeHandler) ContactUs(w http.ResponseWriter, r *http.Request) {
|
||||
println("contact us")
|
||||
if r.Method != http.MethodPost {
|
||||
methodNotAllowed(w)
|
||||
}
|
||||
accessToken, err := getBearerToken(r)
|
||||
if err != nil {
|
||||
forbidden(w)
|
||||
return
|
||||
}
|
||||
refreshClaims, err := ParseRegisteredClaimToken(accessToken)
|
||||
customerId, err := uuid.Parse(refreshClaims.Issuer)
|
||||
if err != nil {
|
||||
badRequest(w, malformedCustomerId)
|
||||
return
|
||||
}
|
||||
userEmail, err := ParseEmail(refreshClaims.Subject)
|
||||
if err != nil {
|
||||
badRequest(w, malformedUserEmail)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
var contactFormPost ContactFormPost
|
||||
if err := decodeJson(w, r, &contactFormPost); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err := h.Api.ContactUs(userEmail, CustomerId(customerId), contactFormPost); err != nil {
|
||||
handleError(w, err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func decodeJson(w http.ResponseWriter, r *http.Request, post any) error {
|
||||
if r.Body == nil {
|
||||
badRequest(w, "unable to parse body")
|
||||
|
||||
Reference in New Issue
Block a user