From 720045d9ea2e612ca0f0b7333ee62a73b2955a15 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 2 Jul 2022 14:41:18 +0530 Subject: Bug Fix: `macli login` showing error message that user is not logged in --- mal/mal.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'mal/mal.go') diff --git a/mal/mal.go b/mal/mal.go index ff915ac..9c55bcf 100644 --- a/mal/mal.go +++ b/mal/mal.go @@ -33,13 +33,15 @@ var userClient u.Client var userAnimeClient ua.Client var userMangaClient um.Client -func init() { +// init() would kill the program prematurely on `macli login` command +func Init() { secret := auth.GetToken() + tk := "Bearer " + secret // initialise MAL2Go Client(s) - animeClient.AuthToken = "Bearer " + secret - mangaClient.AuthToken = "Bearer " + secret - userClient.AuthToken = "Bearer " + secret - userAnimeClient.AuthToken = "Bearer " + secret - userMangaClient.AuthToken = "Bearer " + secret + animeClient.AuthToken = tk + mangaClient.AuthToken = tk + userClient.AuthToken = tk + userAnimeClient.AuthToken = tk + userMangaClient.AuthToken = tk } -- cgit v1.2.3