pull/54/merge
rravula 5 months ago committed by GitHub
commit 68cf4d1c78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,4 +1,5 @@
import axios from 'axios'; import axios from 'axios';
import https from 'https';
import config from '../../config.json'; import config from '../../config.json';
export const getProjects = async () => { export const getProjects = async () => {
@ -23,8 +24,18 @@ export const getWeather = async (city: string) => {
}; };
export const getQuote = async () => { export const getQuote = async () => {
const { data } = await axios.get('https://api.quotable.io/random'); try {
return { const agent = new https.Agent({
quote: `${data.content}” — ${data.author}`, 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