aboutsummaryrefslogtreecommitdiff
path: root/mal
diff options
context:
space:
mode:
Diffstat (limited to 'mal')
-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
}