Skip to content

Commit

Permalink
refactor: use default args
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Jul 11, 2024
1 parent 1af82a0 commit 3a8ea83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/graphql/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ export function formatSpace({

export function formatAddresses(
addresses: string[],
types: ('evmAddress' | 'starknetAddress')[]
types: ('evmAddress' | 'starknetAddress')[] = [
'evmAddress',
'starknetAddress'
]
) {
return addresses
.map(address => {
Expand Down
5 changes: 1 addition & 4 deletions src/graphql/operations/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import log from '../../helpers/log';
import { formatUser, formatAddresses, PublicError } from '../helpers';

export default async function (parent, args) {
const addresses = formatAddresses(
[args.id],
['evmAddress', 'starknetAddress']
);
const addresses = formatAddresses([args.id]);
if (!addresses.length) throw new PublicError('Invalid address');

const query = `SELECT u.* FROM users u WHERE id = ? LIMIT 1`;
Expand Down

0 comments on commit 3a8ea83

Please sign in to comment.