Closed steffenstolze closed 2 years ago
Thanks for the detailed bug report! I think this might be because you aren't exporting your fields in the struct. Could you try that and let me know if that fixes it? Thanks!
type ImportEvent struct {
Status string `json:"status"`
Objekte []Objekt `json:"objekte"`
}
Damn, this was so obvious and I missed it! Sorry for bothering you.
Exporting the fields made it work like a charm, perfect!
Thanks and BR!
@steffenstolze hello brother! I am trying to emit events from backend to frontend but am not able to find the EventsEmit function. How to call it?
Basically, my application requires a OAuth2 kind of authentication in which the app opens an authentication link in the users default browser from where after successfully logged in the browser redirects to a localhost http server which is being handled by the golang. Upon receiving the redirect I want to pass some data to frontend. How can I achieve it?
Do you know any solution?
Description
My "nested" struct Objekt is defined as this:
I've got a slice of this struct
var objekte []Objekt
which I can pass perfectly fine viaruntime.EventsEmit(app.ctx, "importEvent", objekte)
. I can also pass one specific item viaruntime.EventsEmit(app.ctx, "importEvent", objekte[4])
with no problem. I receive the event and canconsole.log
the data on the Vue side.But as soon as I create a wrapper struct, since I want to add some more information to it, and try to pass it like this:
I always receive
{}
on the Vue side. When I change it toruntime.EventsEmit(app.ctx, "importEvent", eventData.objekte)
it works again.The code on the Vue side is very minimal:
Expected behaviour I'd expect the whole object of type
ImportEvent
on the Vue side.System Details
Thanks in advance! BR