aboutsummaryrefslogtreecommitdiff
path: root/mal/mal.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-07-02 14:41:18 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-07-02 14:41:18 +0530
commit720045d9ea2e612ca0f0b7333ee62a73b2955a15 (patch)
treeb25bfecc256408b7fbef71abc2964d439ca6d3bb /mal/mal.go
parentbeacbdf5974ab4eadc2ab651ed59b7bd2dcc6e02 (diff)
Bug Fix: `macli login` showing error message that user is not logged in
Diffstat (limited to 'mal/mal.go')
-rw-r--r--mal/mal.go14
1 files changed, 8 insertions, 6 deletions
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
}