Commit 7f6f193b authored by Eduardo Sanz García's avatar Eduardo Sanz García
Browse files

fix: getClaim wasn't returning default value

parent f5e3878b
......@@ -49,7 +49,11 @@ export class TokenService {
*/
public getClaim < T, C > (claim: string, defaultValue: C): T | C {
try {
return < T > this._jwt.decodeToken()[claim];
const value = < T > this._jwt.decodeToken()[claim];
if (value === undefined) {
return defaultValue;
}
return value;
} catch (e) {
return defaultValue;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment