MCPcopy Index your code
hub / github.com/dnote/dnote / persistAlert

Function persistAlert

pkg/server/views/data.go:102–120  ·  view source on GitHub ↗
(w http.ResponseWriter, alert Alert)

Source from the content-addressed store, hash-verified

100}
101
102func persistAlert(w http.ResponseWriter, alert Alert) {
103 expiresAt := time.Now().Add(5 * time.Minute)
104 lvl := http.Cookie{
105 Name: "alert_level",
106 Value: alert.Level,
107 Expires: expiresAt,
108 Path: "/",
109 HttpOnly: true,
110 }
111 msg := http.Cookie{
112 Name: "alert_message",
113 Value: alert.Message,
114 Expires: expiresAt,
115 Path: "/",
116 HttpOnly: true,
117 }
118 http.SetCookie(w, &lvl)
119 http.SetCookie(w, &msg)
120}
121
122func clearAlert(w http.ResponseWriter) {
123 lvl := http.Cookie{

Callers 1

RedirectAlertFunction · 0.85

Calls 1

NowMethod · 0.65

Tested by

no test coverage detected