Skip to content

Commit c0b92a7

Browse files
committed
changed API key
1 parent 74cd9ee commit c0b92a7

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

src/Components/Loguin/Form.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,21 @@
66
width:50%;
77
height:auto;
88
margin: auto;
9+
}
10+
11+
@media(max-width:650px){
12+
.formu{
13+
width:60%;
14+
}
15+
}
16+
@media(max-width:480px){
17+
.formu{
18+
width:70%;
19+
}
20+
}
21+
22+
@media(max-width:375px){
23+
.formu{
24+
width:84%;
25+
}
926
}

src/Components/Loguin/Register.jsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const Register = () => {
1212
password:""
1313
})
1414
const navigate = useNavigate()
15-
const { signup } = useAuth()
15+
const { signup, loginWithGoogle } = useAuth()
1616

1717
const handelChange = (e)=>{
1818
setRegister({
@@ -36,6 +36,17 @@ export const Register = () => {
3636
navigate("/login")
3737
}
3838

39+
const handelLoguinGoogle = async (e)=>{
40+
e.preventDefault()
41+
try {
42+
await loginWithGoogle()
43+
navigate("/")
44+
} catch (error) {
45+
console.log(error)
46+
}
47+
48+
}
49+
3950
return (
4051
<div className='container-form d-flex flex-column justify-content-center align-content-center'>
4152
<Form className="formu border p-4" onSubmit={handelSubmit}>
@@ -60,6 +71,11 @@ export const Register = () => {
6071
I have account
6172
</Button>
6273
</div>
74+
<div className='d-flex justify-content-center mt-4'>
75+
<Button variant="primary" type="submit" onClick={handelLoguinGoogle}>
76+
Loguin with Google
77+
</Button>
78+
</div>
6379
</Form>
6480
</div>
6581
)

src/Components/Nav/Nav.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const Nav = () => {
2424
|| (/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/)
2525
){
2626
try {
27-
clearDataIp(dispatch)
27+
clearDataIp(dispatch)
2828
getData(dispatch,ipAddress)
2929
} catch (error) {
3030
console.log(error)

src/Components/SectionMap/SectionMap.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export const SectionMap = () => {
1515

1616
useEffect(()=>{
1717
if(state.dataIp){
18+
19+
console.log(state.dataIp)
1820
setLocation({
1921
lati:state.dataIp.location.lat,
2022
long:state.dataIp.location.lng

src/ContentReducer/Action/Action.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { SEARCH_IP, CLEAR_IP } from "./ActionTypes"
22

3-
const apiKey = "at_XFilr7eiAJJP12CMGdWWV3D0X7OCA"
3+
44
export const getData = async(dispatch, ip)=>{
5+
const apiKey = "at_XFilr7eiAJJP12CMGdWWV3D0X7OCA"
56
let data
67
try {
78
let status
8-
status = await fetch(`https://geo.ipify.org/api/v2/country,city?apiKey=${apiKey}&ipAddress${ip}`)
9+
status = await fetch(`https://geo.ipify.org/api/v2/country,city?apiKey=at_XFilr7eiAJJP12CMGdWWV3D0X7OCA&ipAddress=${ip}`)
910
.then(response => status = response.json())
1011
.then(response => data = response)
1112
if(!data.code){
@@ -19,7 +20,7 @@ export const getData = async(dispatch, ip)=>{
1920
}
2021
else{throw new Error(data.messages)}
2122
} catch (error) {
22-
await fetch(`https://geo.ipify.org/api/v2/country,city?apiKey=${apiKey}&ipAddress=8.8.8.8`)
23+
await fetch(`https://geo.ipify.org/api/v2/country,city?apiKey=at_XFilr7eiAJJP12CMGdWWV3D0X7OCA&ipAddress=8.8.8.8`)
2324
.then(response => response.json())
2425
.then(response => data = response)
2526
if(!data.code){

0 commit comments

Comments
 (0)