Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-25 03:08:59 -07:00
parent b1cddd9f60
commit e39a2608e8
1 changed files with 14 additions and 15 deletions

25
main.go
View File

@ -286,15 +286,6 @@ func mainMouseClick(b *gui.ButtonMap) {
}
}
func getToken() string {
if (gui.Data.Current == nil) {
log.Println("gui.Data.Current == nil")
return ""
}
log.Println("gui.Data.Current.Token = ", gui.Data.Current.Token)
return gui.Data.Current.Token
}
// this watches the GUI primarily to process protobuf's
func watchGUI() {
count := 0
@ -309,7 +300,10 @@ func watchGUI() {
if (gui.Data.State == "SEND WEBSOCKET") {
event := pb.MakeGetEvent()
event.Token = getToken()
if (gui.Data.Current == nil) {
event.Token = gui.Data.Current.Token
event.Username = gui.Data.Current.Username
}
log.Println("\tTRIGGERING WEBSOCKET pb.MakeGetEvent() event.Token =", event.Token)
gorillaSendProtobuf(event)
@ -317,8 +311,11 @@ func watchGUI() {
}
if (gui.Data.State == "SEND LOGIN") {
event := pb.MakeLoginEvent()
event.Token = getToken()
if (gui.Data.Current == nil) {
event.Token = gui.Data.Current.Token
event.Username = gui.Data.Current.Username
event.Password = gui.Data.Current.Password
}
log.Println("\tTRIGGERING LOGIN HERE pb.MakeLoginEvent() event.Token =", event.Token)
gorillaSendProtobuf(event)
gui.Data.State = "READ PROTOBUF"
@ -326,9 +323,11 @@ func watchGUI() {
if (gui.Data.State == "CREATE") {
log.Println("\tTRIGGERING CREATE HERE")
event := pb.MakeAddVmEvent()
event.Username = gui.Data.Current.Username
if (gui.Data.Current == nil) {
event.Token = gui.Data.Current.Token
log.Println("\tTRIGGERING LOGIN HERE with event.Token =", event.Token)
event.Username = gui.Data.Current.Username
}
log.Println("\tTRIGGERING CREATE HERE with event.Token =", event.Token)
spew.Dump(event)
gorillaSendProtobuf(event)