Skip to content

Commit

Permalink
fix antipatterns
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Jun 12, 2023
1 parent d19c5ab commit c660edf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/modules/session/login.ts
Expand Up @@ -16,6 +16,8 @@ export const login = async (
> => {
console.log("Logging in");

let result;

if (!(await masa.session.checkLogin())) {
// get challenge
const challengeData = await masa.client.session.getChallenge();
Expand Down Expand Up @@ -55,7 +57,7 @@ export const login = async (
);
}

return {
result = {
address,
userId: checkSignatureResponse.userId,
cookie: challengeData.cookie,
Expand All @@ -68,4 +70,6 @@ export const login = async (
} else {
console.error("Already logged in! Please logout before logging in again.");
}

return result;
};
6 changes: 5 additions & 1 deletion src/modules/soul-name/load.ts
Expand Up @@ -55,17 +55,21 @@ export const loadSoulNameByName = async (
masa: MasaInterface,
soulName: string
): Promise<SoulNameDetails | undefined> => {
let result;

try {
const tokenId = await masa.contracts.instances.SoulNameContract.getTokenId(
soulName
);

return await loadSoulNameByTokenId(masa, tokenId);
result = await loadSoulNameByTokenId(masa, tokenId);
} catch (error: unknown) {
if (error instanceof Error) {
console.error(`Failed to load Soul Name '${soulName}'`, error.message);
}
}

return result;
};

export const loadSoulNamesByNames = async (
Expand Down

0 comments on commit c660edf

Please sign in to comment.