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.
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.
Redirect
This methods redirects the client to another registered Vue Route in your plugin.
RedirectToPortal
This method redirects the client to the index page of the captive portal.
Error
This metohd sends an error toast message to the client.