Skip to content

Commit

Permalink
fix(session: mysql): query bug when querying session data
Browse files Browse the repository at this point in the history
  • Loading branch information
ephrimlawrence committed Feb 29, 2024
1 parent 4948683 commit d46a8a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sessions/mysql.session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class MySQLSession extends BaseSession {
return defaultValue;
}

return (JSON.parse(val.data)[key] || defaultValue) as T;
return (JSON.parse(val.data || '{}')[key] || defaultValue) as T;
}

async getAll<T>(sessionId: string): Promise<T | undefined> {
Expand All @@ -165,6 +165,6 @@ export class MySQLSession extends BaseSession {
return undefined;
}

return JSON.parse(val.data) as T;
return JSON.parse(val.data || '{}') as T;
}
}

0 comments on commit d46a8a6

Please sign in to comment.