diff --git a/internal/whatsapp/whatsapp.go b/internal/whatsapp/whatsapp.go
index f0540ce..6360bbf 100644
--- a/internal/whatsapp/whatsapp.go
+++ b/internal/whatsapp/whatsapp.go
@@ -148,6 +148,7 @@ func Login(c echo.Context) error {
WhatsApp Multi-Device Login
+
diff --git a/pkg/whatsapp/whatsapp.go b/pkg/whatsapp/whatsapp.go
index 311130c..464db3b 100644
--- a/pkg/whatsapp/whatsapp.go
+++ b/pkg/whatsapp/whatsapp.go
@@ -79,7 +79,6 @@ func WhatsAppInitClient(device *store.Device, jid string) {
func WhatsAppGenerateQR(qrChan <-chan whatsmeow.QRChannelItem) (string, int) {
qrChanCode := make(chan string)
qrChanTimeout := make(chan int)
- qrChanBase64 := make(chan string)
// Get QR Code Data and Timeout
go func() {
@@ -91,17 +90,12 @@ func WhatsAppGenerateQR(qrChan <-chan whatsmeow.QRChannelItem) (string, int) {
}
}()
- // Generate QR Code Data to PNG Base64 Format
- go func() {
- select {
- case tmp := <-qrChanCode:
- png, _ := qrCode.Encode(tmp, qrCode.Medium, 256)
- qrChanBase64 <- base64.StdEncoding.EncodeToString(png)
- }
- }()
+ // Generate QR Code Data to PNG Image
+ qrTemp := <-qrChanCode
+ qrPNG, _ := qrCode.Encode(qrTemp, qrCode.Medium, 256)
- // Return QR Code and Timeout Information
- return <-qrChanBase64, <-qrChanTimeout
+ // Return QR Code PNG in Base64 Format and Timeout Information
+ return base64.StdEncoding.EncodeToString(qrPNG), <-qrChanTimeout
}
func WhatsAppLogin(jid string) (string, int, error) {