Skip to content

Commit

Permalink
fix: Debug production
Browse files Browse the repository at this point in the history
  • Loading branch information
FacundoInza committed Oct 3, 2023
1 parent 8cb468d commit 5a76ef9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"@typescript-eslint/no-explicit-any": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off",
"prettier/prettier": "warn",
"no-console": "error" // Agrega la regla para prohibir console.log en archivos JS
"prettier/prettier": "warn"
}
}
]
Expand Down
4 changes: 4 additions & 0 deletions adapters/userAdapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ function isValidUser(user: any): user is IUser {
export async function getUserFromServer(): Promise<IUser> {
const token = cookies().get('token');

console.log('token -> getuserfromserver', token);

const payload = await validateToken(token?.value as string);

console.log('payload -> getUserFromSever', payload);

if (!payload || !isValidUser(payload.user)) {
return userEmpty;
}
Expand Down
3 changes: 3 additions & 0 deletions utils/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ export const validateToken = async (token: string) => {
algorithms: ['HS256'], // Specify the algorithm you are using
});

console.log('payload -> validateToken', payload);

return payload;
} catch (error) {
console.error('Error al validar el token:', error);
return null;
}
};

0 comments on commit 5a76ef9

Please sign in to comment.