Skip to content

VueResponse

VueResponse Methods

The methods within VueResponse are used to send http response to the browser that's using the $flare.http.get or $flare.http.post helper methods.

SetFlashMsg

This method is to send a toast message to the client. This does not send a response to the client. Thus, it must be called along with Json, Redirect or RedirectToPortal methods to send the response to the client. See the Json documentation for sending json data.

data := nil
res := api.Http().VueResponse()
res.SetFlashMsg("success", "Hello, World!")
res.Json(w, data, http.StatusOK)

SendFlashMsg

This method is similar to SetFlashMsg but it sends the message to the client immediately. Its only use is to send a toast message to the client.

res := api.Http().VueResponse()
res.SendFlashMsg(w, "success", "Hello, World!", http.StatusOK)

Json

Used to send a JSON response to the client. The data can be any type as long as it can be marshalled to JSON.

res := api.Http().VueResponse()
res.Json(w, data, http.StatusOK)

Redirect

This methods redirects the client to another registered Vue Route in your plugin.

res := api.Http().VueResponse()
res.Redirect(w, "route-name")

RedirectToPortal

This method redirects the client to the index page of the captive portal.

res := api.Http().VueResponse()
res.RedirectToPortal(w)

Error

This metohd sends an error toast message to the client.

res := api.Http().VueResponse()
res.Error(w, "An error occurred", http.StatusInternalServerError)