Skip to content

Commit

Permalink
fixed linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
amorey committed Sep 22, 2024
1 parent af55623 commit f9589a5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions shared/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,16 @@ export async function getTokenString(request: Request, valueFn?: TokenValueFunct
if (!Array.isArray(args) || args.length === 0) return rawVal;

const args0 = args[0];
const typeofArgs0 = typeof args0;

switch (typeof args0) {
case 'string':
// treat first string argument as csrf token
return args0;
case 'object':
// if first argument is an object, look for token there
return args0.csrf_token || '';
if (typeofArgs0 === 'string') {
// treat first string argument as csrf token
return args0;
}

if (typeofArgs0 === 'object') {
// if first argument is an object, look for token there
return args0.csrf_token || '';
}

return args0;
Expand Down

0 comments on commit f9589a5

Please sign in to comment.