Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vytaux committed Dec 12, 2024
1 parent 9a79023 commit 974a3d3
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 35 deletions.
8 changes: 0 additions & 8 deletions .eslintrc.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import './App.css';
import { BrowserRouter } from "react-router-dom";
import Header from "./containers/Header/Header";
import PageRoutes from './routes/PageRoutes';
import { useContext, useEffect } from 'react';
import {useContext, useEffect} from 'react';
import UserContext from "./context/UserContext";
import Footer from "./containers/Footer/Footer";


const App = () => {
const App = (callback, deps) => {
const { currentUser, updateUser } = useContext(UserContext)

document.title = 'NextHome | #1 Real Estate Platform in the World!';
Expand All @@ -22,7 +22,7 @@ const App = () => {
updateUser(JSON.parse(user));

}
}, []);
}, [updateUser]);

return (
<BrowserRouter>
Expand Down
5 changes: 2 additions & 3 deletions src/components/EditOffer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, {useEffect, useRef, useState} from "react";
import {Link, useLocation, useNavigate, useParams} from "react-router-dom";
import React, {useRef} from "react";
import {useLocation, useNavigate} from "react-router-dom";
import FetchService from "../service/FetchService";
import hasRole from "../util/hasRole";


const EditProperty = ({ currentUser }) => {
Expand Down
5 changes: 2 additions & 3 deletions src/components/EditProperty.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useEffect, useRef, useState } from "react";
import { Link, useLocation, useNavigate, useParams } from "react-router-dom";
import React, { useRef } from "react";
import { useLocation, useNavigate, useParams } from "react-router-dom";
import FetchService from "../service/FetchService";
import hasRole from "../util/hasRole";


const EditProperty = ({ currentUser }) => {
Expand Down
1 change: 0 additions & 1 deletion src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useRef } from "react";
import { useNavigate } from "react-router-dom";
import FetchService from "../service/FetchService";
import extractJwtPayload from "../util/extractJwtPayload";
import pageRoutes from "../routes/PageRoutes";

const Login = ({ setCurrentUser }) => {

Expand Down
1 change: 0 additions & 1 deletion src/components/Register.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useRef } from "react";
import FetchService from "../service/FetchService";
import extractJwtPayload from "../util/extractJwtPayload";
import { useNavigate } from "react-router-dom";

function Register() {
Expand Down
4 changes: 2 additions & 2 deletions src/components/SubmitOffer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useContext, useEffect, useRef, useState } from "react";
import { Link, useParams } from "react-router-dom";
import React, { useContext, useRef } from "react";
import { Link } from "react-router-dom";
import FetchService from "../service/FetchService";
import hasRole from "../util/hasRole";
import UserContext from "../context/UserContext";
Expand Down
8 changes: 4 additions & 4 deletions src/containers/AdminDashboard.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React, { useEffect } from "react";
import React, {useCallback, useEffect} from "react";
import FetchService from "../service/FetchService";

function AdminDashboard({ currentUser }) {
// always authenticated and authorized

const [ownersState, setOwnersState] = React.useState([]);

const refreshOwners = () => {
const refreshOwners = useCallback(() => {
FetchService.getPendingOwners(currentUser.accessToken).then((response) =>
setOwnersState(response.data)
);
};
}, [currentUser.accessToken]);

useEffect(() => refreshOwners(), []);
useEffect(() => refreshOwners(), [refreshOwners]);

const approveOwner = (userId) => {
FetchService.approveOwner(currentUser.accessToken, userId).then(() =>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/CustomerDashboard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useCallback, useEffect} from "react";
import FetchService from "../service/FetchService";
import formatMoney from "../util/formatMoney";
import { Link, Navigate } from "react-router-dom";
import { Link } from "react-router-dom";

function CustomerDashboard({ currentUser }) {
const [offersState, setOffersState] = React.useState([]);
Expand Down
5 changes: 1 addition & 4 deletions src/containers/Footer/Footer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import React, { useContext } from "react";
import { Link, useNavigate } from "react-router-dom";
import UserContext from "../../context/UserContext";
import hasRole from "../../util/hasRole";
import React from "react";
import './Footer.css';

const Footer = () => {
Expand Down
11 changes: 6 additions & 5 deletions src/context/UserContextProvider.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { useState } from "react";
import {useCallback, useState} from "react";
import UserContext from "./UserContext";

const UserContextProvider = ({ children }) => {
const [currentUser, setcurrentUser] = useState(null);
const [currentUser, setCurrentUser] = useState(null);

const updateUser = (newUser) => {
setcurrentUser(newUser);
};
// Memoize the updateUser function
const updateUser = useCallback((newUser) => {
setCurrentUser(newUser);
}, []);

return (
<UserContext.Provider value={{ currentUser, updateUser }}>
Expand Down

0 comments on commit 974a3d3

Please sign in to comment.