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', {
password: process.env.USER_PWD,
})
.then((res) => {
const config = {
headers: { Authorization: `Bearer ${res.data.accessToken}` },
};
axios
.post('http://localhost:3000/api/structures/resetSearchIndex', {}, config)
console.log(`Structures | statusCode: ${res.status}`);
})
.catch((error) => {
console.error('Error in structure search reset');
console.error(error);
});
axios
.post('http://localhost:3000/api/employer/searchIndex', {}, config)
.then((res) => {
console.log(`Employers | statusCode: ${res.status}`);
console.error('Error in employer search reset');
axios
.post('http://localhost:3000/api/userRegistry/searchIndex', {}, config)
.then((res) => {
console.log(`Users | statusCode: ${res.status}`);
})
.catch((error) => {
console.error('Error in user search reset');
})
.catch((error) => {
console.error('Error in auth');
console.error(error);
});