15 lines
639 B
JavaScript
15 lines
639 B
JavaScript
|
|
import fs from 'fs';
|
||
|
|
import os from 'os';
|
||
|
|
import axios from 'axios';
|
||
|
|
|
||
|
|
const configPath = os.homedir() + '/.config/fjtui/fjtui.json';
|
||
|
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||
|
|
|
||
|
|
axios.post(config.url + '/api/v1/repos/' + config.repo + '/issues/1/times', { time: 3600 }, {
|
||
|
|
headers: { 'Authorization': 'token ' + config.token }
|
||
|
|
}).then(r => console.log('Added time')).catch(e => console.error(e.message));
|
||
|
|
|
||
|
|
axios.get(config.url + '/api/v1/repos/' + config.repo + '/issues/1', {
|
||
|
|
headers: { 'Authorization': 'token ' + config.token }
|
||
|
|
}).then(r => console.log(Object.keys(r.data))).catch(e => console.error(e.message));
|