Newer
Older
/* eslint-disable @typescript-eslint/no-var-requires */
const axios = require('axios');
const path = require('path');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
axios
.post('http://localhost:3000/api/auth/login', {
email: 'admin@admin.com',
password: process.env.USER_PWD,
})
.then((res) => {
const config = {
headers: { Authorization: `Bearer ${res.data.accessToken}` },
};
axios
.get('http://localhost:3000/api/tcl/update', config)
.then((res) => {
console.log(`TCL stop points | statusCode: ${res.status}`);
})
.catch((error) => {
console.error('Error in fetching TCL stop points');
console.error(error);
});
})
.catch((error) => {
console.error('Error in auth');
console.error(error);
});