Fixed axios and generate token

This commit is contained in:
2022-11-11 09:25:29 +07:00
parent 42928444aa
commit 6d1a2fdc39
6 changed files with 25 additions and 15 deletions

View File

@@ -265,8 +265,13 @@ program
if (!config.token) {
console.log("Generating token...");
await getTokenFree(config.server)
await getTokenFree(config.server, {
timestamp: (new Date().getTime()),
clientId: config.clientId,
apiKey: config.apiKey,
})
.then((resp: any) => {
console.log("Token generated successfully!");
if (resp.data?.token) {
config.token = resp.data?.token;
} else {

View File

@@ -1,4 +1,4 @@
const axios = require("axios").default;
const axios = require("axios");
const getTokenFree = async (baseUrl: string, data: any = {}) => {
const url = `${baseUrl}/__free__/api/get_token`;