Providing feedback when searching by room, and connecting to the reservation page
This commit is contained in:
		@ -245,9 +245,12 @@ func (m *Repository) PostAvailability(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type responseJSON struct {
 | 
			
		||||
	OK      bool   `json:"ok"`
 | 
			
		||||
	Message string `json:"message"`
 | 
			
		||||
type jsonResponse struct {
 | 
			
		||||
	OK        bool   `json:"ok"`
 | 
			
		||||
	Message   string `json:"message"`
 | 
			
		||||
	RoomID    string `json:"room_id"`
 | 
			
		||||
	StartDate string `json:"start_date"`
 | 
			
		||||
	EndDate   string `json:"end_date"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AvailabilityJSON is the search for availability page handler
 | 
			
		||||
@ -279,9 +282,12 @@ func (m *Repository) AvailabilityJSON(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp := responseJSON{
 | 
			
		||||
		OK:      available,
 | 
			
		||||
		Message: "",
 | 
			
		||||
	resp := jsonResponse{
 | 
			
		||||
		OK:        available,
 | 
			
		||||
		Message:   "",
 | 
			
		||||
		StartDate: sd,
 | 
			
		||||
		EndDate:   ed,
 | 
			
		||||
		RoomID:    strconv.Itoa(roomID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	out, err := json.MarshalIndent(resp, "", "    ")
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user