Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
HauseMasterZ committed Oct 29, 2023
1 parent 28256dc commit 0dd8586
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
17 changes: 17 additions & 0 deletions .envlocal
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
REACT_APP_FIREBASE_API_KEY = "AIzaSyCf9qJhMUay4wpxUhnTK2F4AEMwQQbgMzs"
REACT_APP_FIREBASE_AUTH_DOMAIN = "swift-type-7007d.firebaseapp.com"
REACT_APP_FIREBASE_DATABASE_URL = "https://swift-type-7007d-default-rtdb.firebaseio.com"
REACT_APP_FIREBASE_PROJECT_ID = "swift-type-7007d"
REACT_APP_FIREBASE_STORAGE_BUCKET = "swift-type-7007d.appspot.com"
REACT_APP_FIREBASE_MESSAGING_SENDER_ID = "222901755498"
REACT_APP_FIREBASE_APP_ID = "1:222901755498:web:9a4e301498276b0cc7f413"
REACT_APP_FIREBASE_MEASUREMENT_ID = "G-Y7Q59PEQ4M"
REACT_APP_FIREBASE_COLLECTION_NAME = "users"
REACT_APP_USERNAME_KEY = "user-name"
REACT_APP_PROFILE_PHOTO_URL_KEY = "profile-photo-url"
REACT_APP_TOTAL_RACES_TAKEN_KEY = "totalRacesTaken"
REACT_APP_TOTAL_AVG_ACCURACY_KEY = "totalAverageAccuracy"
REACT_APP_TOTAL_AVG_WPM_KEY = "totalAverageWpm"
REACT_APP_EMAIL_KEY = "email-id"
REACT_APP_CREATED_AT_KEY = "created-at"
REACT_APP_DEFAULT_PROFILE_PHOTO_URL = "https://firebasestorage.googleapis.com/v0/b/swift-type-7007d.appspot.com/o/avatars%2Fdefaultuser0-avatar.png?alt=media&token=32c301bf-32ea-4ba3-aea6-c0a9ce827d57"
9 changes: 3 additions & 6 deletions src/components/Forgot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { collection } from 'firebase/firestore';
import { useNavigate } from 'react-router-dom';
Expand All @@ -11,20 +11,18 @@ import HamburgerMenu from './Hamburger';
import LoadingSpinner from './LoadingSpinner';
function Forgot() {
const navigate = useNavigate();
const [error, setError] = useState(null);
const [isLoading, setIsLoading] = useState(false);
const [isSent, setIsSent] = useState(false);
const [email, setEmail] = useState('');

const handleSubmit = async (event) => {
event.preventDefault();
setIsLoading(true);
setError(null);
try {
const usernameQuery = query(collection(db, process.env.REACT_APP_FIREBASE_COLLECTION_NAME), where(process.env.REACT_APP_USERNAME_KEY, '==', email));
const emailQuery = query(collection(db, process.env.REACT_APP_FIREBASE_COLLECTION_NAME), where(process.env.REACT_APP_EMAIL_KEY, '==', email));
const [usernameDoc, emailDoc] = await Promise.all([getDocs(usernameQuery), getDocs(emailQuery)]);

usernameDoc = usernameDoc.docs;
if (emailDoc.size === 0) {
alert('Email doesnt exist');
return;
Expand All @@ -34,7 +32,6 @@ function Forgot() {
setIsSent(true);
} catch (error) {
console.error(error);
setError(error.message);
} finally {
setIsLoading(false);
}
Expand All @@ -50,7 +47,7 @@ function Forgot() {
});

return () => unsubscribe();
}, []);
}, [navigate]);

return (
<div className={`container`}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Hamburger.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const HamburgerMenu = ({ user, handleLogoutClick, ...props }) => {
{user ? (
<>
<Link href="#" to="/profile" style={{ 'display': 'inline-block' }}>
<img src={props.profilePhotoUrl} alt="picture" className='dropdown-avatar' />
<img src={props.profilePhotoUrl} className='dropdown-avatar' />
{props.username}
</Link>
<Link href="#" to="/settings" >Account Settings</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Header() {
<i className="bx bx-moon moon"></i>
</div>
<div className="github">
<a href="https://github.com/HauseMasterZ/swift-type" target="_blank">
<a href="https://github.com/HauseMasterZ/swift-type" target="_blank" rel='noopener'>
<i className="bx bxl-github"></i>
</a>
</div>
Expand Down

0 comments on commit 0dd8586

Please sign in to comment.