mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
Write a Set-Cookie header with the last used summary interval
This commit is contained in:
parent
e89ce076fd
commit
ebe1836ac6
@ -4,10 +4,12 @@ import (
|
|||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/middlewares"
|
"github.com/muety/wakapi/middlewares"
|
||||||
|
"github.com/muety/wakapi/models"
|
||||||
"github.com/muety/wakapi/models/view"
|
"github.com/muety/wakapi/models/view"
|
||||||
su "github.com/muety/wakapi/routes/utils"
|
su "github.com/muety/wakapi/routes/utils"
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -49,8 +51,9 @@ func (h *SummaryHandler) GetIndex(w http.ResponseWriter, r *http.Request) {
|
|||||||
q.Set("interval", "today")
|
q.Set("interval", "today")
|
||||||
}
|
}
|
||||||
r.URL.RawQuery = q.Encode()
|
r.URL.RawQuery = q.Encode()
|
||||||
} else {
|
} else if q.Get("interval") != "" {
|
||||||
// TODO: Add a `Set-Cookie: interval` header to persit it on the front-end
|
headerValue := fmt.Sprintf("%s=%s", models.PersistentIntervalKey, q.Get("interval"))
|
||||||
|
w.Header().Add("Set-Cookie", headerValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
summaryParams, _ := utils.ParseSummaryParams(r)
|
summaryParams, _ := utils.ParseSummaryParams(r)
|
||||||
|
Loading…
Reference in New Issue
Block a user