|
|
@ -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.',
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|