Skip to content

Commit

Permalink
Addressed eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
macterra committed Oct 25, 2023
1 parent 917e0a9 commit 933372e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 31 deletions.
4 changes: 2 additions & 2 deletions frontend/src/AgentBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';

const AgentBadge = ({ agent, xid }) => {

const [user, setUser, refreshProfile] = useState(null);
const [user, setUser] = useState(null);

useEffect(() => {
const fetchAgent = async () => {
Expand All @@ -21,7 +21,7 @@ const AgentBadge = ({ agent, xid }) => {
};

fetchAgent();
}, [agent, xid, refreshProfile]);
}, [agent, xid]);

if (!user) {
return;
Expand Down
25 changes: 4 additions & 21 deletions frontend/src/AssetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,18 @@ const AssetView = ({ navigate }) => {
const [isDeleted, setIsDeleted] = useState(false);
const [tab, setTab] = useState("meta");
const [refreshKey, setRefreshKey] = useState(0);
const [isAuthenticated, setIsAuthenticated] = useState(null);

useEffect(() => {
const fetchMetadata = async () => {
try {
const auth = await axios.get('/check-auth');
const isAuthenticated = auth.data.isAuthenticated;
setIsAuthenticated(isAuthenticated);

const asset = await axios.get(`/api/v1/asset/${xid}`);
const metadata = asset.data;
setMetadata(metadata);

const isToken = !!metadata.token;
setIsToken(isToken);

if (metadata.asset.collection === 'deleted') {
setIsDeleted(true);
} else {
setIsDeleted(false);
}

if (isAuthenticated) {
setIsOwner(metadata.userIsOwner);
} else {
setIsOwner(false);
}
setIsToken(!!metadata.token);
setIsDeleted(metadata.asset.collection === 'deleted');
setIsOwner(metadata.userIsOwner);
} catch (error) {
console.error('Error fetching image metadata:', error);
console.error('Error fetching metadata:', error);
}
};

Expand Down
1 change: 0 additions & 1 deletion frontend/src/AuditLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
TableHead,
Paper,
} from '@mui/material';
import AgentBadge from './AgentBadge';

const AuditLog = () => {
const [txnlog, setTxnLog] = useState([]);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/InvoiceView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const InvoiceView = ({ invoice }) => {
const [expired, setExpired] = useState(false);
const [paid, setPaid] = useState(false);

let timerId;

useEffect(() => {
let timerId;

if (paid) {
clearInterval(timerId);
return;
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/NftView.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@ const NftView = ({ navigate }) => {
const [isOwner, setIsOwner] = useState(false);
const [tab, setTab] = useState("edition");
const [refreshKey, setRefreshKey] = useState(0);
const [isAuthenticated, setIsAuthenticated] = useState(null);

useEffect(() => {
const fetchMetadata = async () => {
try {
const auth = await axios.get('/check-auth');
const isAuthenticated = auth.data.isAuthenticated;
const asset = await axios.get(`/api/v1/nft/${xid}`);
const nft = asset.data;

setIsAuthenticated(isAuthenticated);
setNft(nft);
setIsOwner(nft.owned);
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ProfileEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ProfileEditor = ({ navigate, refreshProfile, setRefreshProfile }) => {
};

fetchProfile();
}, [navigate, jump, refreshProfile]);
}, [navigate, tab, jump, refreshProfile]);

if (!profile) {
return;
Expand Down

0 comments on commit 933372e

Please sign in to comment.