File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ export const RandomQuote = () => {
1010 setQuote ( null ) ;
1111 setError ( null ) ;
1212
13- const url = "https://zenquotes.io /api/random " ;
13+ const url = "https://stoic-quotes.com /api/quote " ;
1414 const proxyUrl = `https://api.allorigins.win/get?url=${ encodeURIComponent (
15- ` ${ url } ?t=${ Date . now ( ) } `
15+ url + ` ?t=${ Date . now ( ) } `
1616 ) } `;
1717
1818 axios
1919 . get ( proxyUrl )
2020 . then ( ( res ) => {
21+ // Parse the contents returned by the proxy
2122 const data = JSON . parse ( res . data . contents ) ;
22- const q = data [ 0 ] ;
23- setQuote ( { q : q . q , a : q . a } ) ;
23+ setQuote ( { q : data . text , a : data . author } ) ;
2424 } )
2525 . catch ( ( err ) => {
2626 setError ( err ) ;
@@ -45,9 +45,7 @@ export const RandomQuote = () => {
4545 </ div >
4646 ) }
4747
48- { error && (
49- < div className = "rquote-content error" > { error . message } </ div >
50- ) }
48+ { error && < div className = "rquote-content error" > { error . message } </ div > }
5149
5250 { ! quote && ! error && (
5351 < div className = "spinner-wrapper" >
You can’t perform that action at this time.
0 commit comments