From 553470618913fca61232761e3ffcfa8efe00cbab Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Tue, 17 Dec 2024 17:58:08 +0300 Subject: [PATCH] reset the state when input is nil --- internal/handlers/ussd/menuhandler.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/handlers/ussd/menuhandler.go b/internal/handlers/ussd/menuhandler.go index c5356d0..c2b41b2 100644 --- a/internal/handlers/ussd/menuhandler.go +++ b/internal/handlers/ussd/menuhandler.go @@ -124,6 +124,16 @@ func (h *Handlers) Init(ctx context.Context, sym string, input []byte) (resource h.st = h.pe.GetState() h.ca = h.pe.GetMemory() + + fmt.Println("Pre restart state:", h.st) + + if len(input) == 0 { + h.st.Restart() + h.st = h.pe.GetState() + } + + fmt.Println("New state:", h.st) + sessionId, _ := ctx.Value("SessionId").(string) flag_admin_privilege, _ := h.flagManager.GetFlag("flag_admin_privilege")