Skip to content

Commit

Permalink
fix: PRO-2395 adjust the property name to typescript model fieldnames
Browse files Browse the repository at this point in the history
  • Loading branch information
kanthgithub committed Jun 13, 2024
1 parent 11fb2d7 commit 625afd0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions admin_frontend/src/context/AuthContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const AuthContextProvider = ({ children }) => {
try {
const data = await fetch(`${process.env.REACT_APP_SERVER_URL}${ENDPOINTS['adminLogin']}`, {
method: "POST",
body: JSON.stringify({ WALLET_ADDRESS: accounts[0] }),
body: JSON.stringify({ walletAddress: accounts[0] }),
});
const dataJson = await data.json();
if (!dataJson.error) {
Expand Down Expand Up @@ -47,7 +47,7 @@ export const AuthContextProvider = ({ children }) => {
const address = await initializeProvider();
const data = await fetch(`${process.env.REACT_APP_SERVER_URL}${ENDPOINTS['adminLogin']}`, {
method: "POST",
body: JSON.stringify({ WALLET_ADDRESS: address }),
body: JSON.stringify({ walletAddress: address }),
});
const dataJson = await data.json();
if (!dataJson.error) {
Expand Down
8 changes: 4 additions & 4 deletions backend/src/routes/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const adminRoutes: FastifyPluginAsync = async (server) => {
try {
const body: any = JSON.parse(request.body as string);
if (!body) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.EMPTY_BODY });
if (!body.WALLET_ADDRESS) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_DATA });
if (ethers.utils.getAddress(body.WALLET_ADDRESS) === server.config.ADMIN_WALLET_ADDRESS) return reply.code(ReturnCode.SUCCESS).send({ error: null, message: "Successfully Logged in" });
if (!body.walletAddress) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_DATA });
if (ethers.utils.getAddress(body.walletAddress) === server.config.ADMIN_WALLET_ADDRESS) return reply.code(ReturnCode.SUCCESS).send({ error: null, message: "Successfully Logged in" });
return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_USER });
} catch (err: any) {
return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_USER });
Expand Down Expand Up @@ -178,11 +178,11 @@ const adminRoutes: FastifyPluginAsync = async (server) => {
try {
const body: any = JSON.parse(request.body as string);
if (!body) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.EMPTY_BODY });
if (!body.WALLET_ADDRESS) {
if (!body.walletAddress) {
return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_DATA });
}

const apiKeyEntity = await server.apiKeyRepository.findOneByWalletAddress(body.WALLET_ADDRESS);
const apiKeyEntity = await server.apiKeyRepository.findOneByWalletAddress(body.walletAddress);
if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_DATA });

let supportedNetworks;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const Dashboard = ({ logInType }) => {
const data = await (
await fetch(`${process.env.REACT_APP_SERVER_URL}${ENDPOINTS['getSupportedNetworks']}`, {
method: "POST",
body: JSON.stringify({ WALLET_ADDRESS: address }),
body: JSON.stringify({ walletAddress: address }),
})
).json();
const supportedNetworksChainIds = [];
Expand Down

0 comments on commit 625afd0

Please sign in to comment.