Skip to content

Commit 49efa50

Browse files
Merge pull request #24 from MohamedRizwan399/develop
Bugs fixed for production
2 parents 2995223 + b82bd0c commit 49efa50

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/fetchApiData/FetchApi.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import React ,{useEffect, useState} from 'react'
22
import axios from 'axios'
33
import { toast } from 'react-toastify'
44
import ClipLoader from 'react-spinners/ClipLoader';
5+
import { posts } from '../homePage/data';
56

7+
//Sample url(local env) - https://newsapi.org/v2/top-headlines?country=us&apiKey=6004b8fcb1604003b4ead57854e8d2c2
68
function FetchApi() {
79
const [data, setData] = useState([]);
810
const [isLoading, setIsLoading] = useState(false);
@@ -12,9 +14,9 @@ function FetchApi() {
1214
//sample get api
1315
try {
1416
setIsLoading(true);
15-
await axios.get("https://newsapi.org/v2/top-headlines?country=us&apiKey=6004b8fcb1604003b4ead57854e8d2c2")
17+
await axios.get("https://api.thecatapi.com/v1/images/search?limit=10")
1618
.then((response) => {
17-
setData(response?.data?.articles);
19+
setData(response?.data);
1820
})
1921
} catch (e) {
2022
console.error(e);
@@ -37,19 +39,19 @@ function FetchApi() {
3739
return (
3840
<>
3941
<div className="btn-fetchContainer">
40-
<button className='btn-fetch' onClick={data.length > 0 ? showToast : fetchData}>Click here to Fetch Api Data!!</button>
42+
<button className='btn-fetch' onClick={data?.length > 0 ? showToast : fetchData}>Click here to Fetch Api Data!!</button>
4143
</div>
4244

4345
<div className="ui-fetched">
4446
{
4547
data.map((value, index) => {
46-
const imageUrl = value?.urlToImage;
48+
const imageUrl = value?.url;
4749
return(
4850
<div className='card' style={{width: "20rem"}} key={index}>
4951
<img src={(imageUrl && imageUrl !== null) ? imageUrl : thumbImage} className="card-img-top" width={300} alt={value?.title}/>
5052
{imageUrl !== null && <div className="card-body">
51-
<h5 className="card-title">{value?.title}</h5>
52-
<p className="card-desc">{value?.description}</p><br></br>
53+
<h5 className="card-title">{value?.id}</h5>
54+
<p className="card-desc">{posts[0]?.desc}</p><br></br>
5355
Want to Read more, <a href={value?.url || "/notfound"} target='_blank' rel='noopener noreferrer' className="btn-primary"> <span style={{fontWeight: "bold"}}>Click here</span></a>
5456
</div>}
5557
</div>

src/homePage/Footer.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ function Footer() {
1414
<Container>
1515
<Row>
1616
<Column>
17-
<FooterLink href="./aboutus">About Us</FooterLink><br></br>
17+
<FooterLink href="#/aboutus">About Us</FooterLink><br></br>
1818
</Column>
1919
<Column>
20-
<FooterLink href="./contactus">Contact Us</FooterLink><br></br>
20+
<FooterLink href="#/contactus">Contact Us</FooterLink><br></br>
2121
</Column>
2222

2323
</Row>

src/loginAuthentication/LoginPage.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ function LoginPage(props) {
194194
}
195195

196196
// handle Google signIn method
197-
function googleLogin() {
197+
async function googleLogin() {
198198
//signInWithRedirect(auth, provider) // alternative for Glogin
199-
signInWithPopup(auth, provider).then((data) => {
199+
await signInWithPopup(auth, provider).then((data) => {
200200
storeLoginSuccessAndNavigate(data?.user);
201201
}).catch((e) => {
202-
console.error("signinpopup catch--", e);
202+
console.error("signinpopup catch--", e);
203203
})
204204
}
205205

0 commit comments

Comments
 (0)