eprolo-cli 1.0.97 → 1.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/eprolo-cli.js +6 -11
- package/package.json +1 -1
package/bin/eprolo-cli.js
CHANGED
|
@@ -106,18 +106,16 @@ async function postJsonWithRetry(url, body, config, method = "POST") {
|
|
|
106
106
|
let result = await postJson(url, body, headers, method);
|
|
107
107
|
if (result.data.code == '-1') {
|
|
108
108
|
// 刷新 token
|
|
109
|
-
const refreshRes = await postJson(
|
|
110
|
-
refreshToken: config.refreshToken
|
|
111
|
-
});
|
|
109
|
+
const refreshRes = await postJson(LOGIN_API, {penApiKey: config.refreshToken});
|
|
112
110
|
|
|
113
|
-
if (refreshRes.data.code == 0
|
|
111
|
+
if (refreshRes.data.code == 0) {
|
|
114
112
|
// 更新凭据文件
|
|
115
|
-
body.timestamp = data.data.timestamp;
|
|
116
|
-
body.sign = data.data.accessToken;
|
|
117
|
-
writeConfig(data.data);
|
|
113
|
+
body.timestamp = refreshRes.data.data.timestamp;
|
|
114
|
+
body.sign = refreshRes.data.data.accessToken;
|
|
115
|
+
writeConfig(refreshRes.data.data);
|
|
118
116
|
|
|
119
117
|
// 用新 token 重试
|
|
120
|
-
headers["apiKey"] = `${
|
|
118
|
+
headers["apiKey"] = `${refreshRes.data.data.apiKey}`;
|
|
121
119
|
result = await postJson(url, body, headers,method);
|
|
122
120
|
}
|
|
123
121
|
else {
|
|
@@ -153,9 +151,6 @@ async function login(argv) {
|
|
|
153
151
|
}));
|
|
154
152
|
process.exit(1);
|
|
155
153
|
}
|
|
156
|
-
// res.data.data.openApiKey = userCode;
|
|
157
|
-
// const { account, accessToken, accountId, shopId } = res.data;
|
|
158
|
-
// const config = { account, accessToken, defaultShop, accountId, shopId, version: 1 };
|
|
159
154
|
writeConfig(res.data.data);
|
|
160
155
|
|
|
161
156
|
console.log("login ok");
|
package/package.json
CHANGED