thinkncollab-cli 0.0.55 → 0.0.56
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/commands/myTask.js +13 -1
- package/package.json +1 -1
package/commands/myTask.js
CHANGED
|
@@ -19,14 +19,26 @@ async function getEmail() {
|
|
|
19
19
|
const email = JSON.parse(content).email;
|
|
20
20
|
return email;
|
|
21
21
|
}
|
|
22
|
+
async function getToken() {
|
|
23
|
+
const rcFile = path.join(homeDir, '.tncrc');
|
|
24
|
+
if(!fx.readFileSync(rcFile)){
|
|
25
|
+
console.log("⚠️ Please login first! ")
|
|
26
|
+
}
|
|
27
|
+
const content = fs.readFileSync(rcFile, 'utf-8');
|
|
28
|
+
const token = JSON.parse(content).token;
|
|
29
|
+
return token;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
}
|
|
22
33
|
|
|
23
34
|
// Fetch tasks for a given room
|
|
24
35
|
async function myTask(roomId) {
|
|
25
36
|
try {
|
|
26
37
|
const email = await getEmail();
|
|
38
|
+
const token = await getToken();
|
|
27
39
|
|
|
28
40
|
const res = await axios.get(`${url}/${roomId}`, {
|
|
29
|
-
params: { email } // since backend uses req.query
|
|
41
|
+
params: { email, token } // since backend uses req.query
|
|
30
42
|
});
|
|
31
43
|
|
|
32
44
|
const tasks = res.data.tasks;
|