Disabling SSL verification for GetQuote

pull/54/head
rravula 5 months ago
parent 1f2e543bdb
commit 5ae5aef67b

@ -1,4 +1,5 @@
import axios from 'axios';
import https from 'https';
import config from '../../config.json';
export const getProjects = async () => {
@ -23,8 +24,18 @@ export const getWeather = async (city: string) => {
};
export const getQuote = async () => {
const { data } = await axios.get('https://api.quotable.io/random');
try {
const agent = new https.Agent({
rejectUnauthorized: false, // Disable SSL verification
});
const { data } = await axios.get('https://api.quotable.io/random', { httpsAgent: agent });
return {
quote: `${data.content}” — ${data.author}`,
};
} catch (error) {
return {
quote: 'Unable to fetch a quote at the moment. Please try again later.',
};
}
};

Loading…
Cancel
Save