u
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { meJson } from '../../auth/meJson.js';
|
||||
import { respondWithAuthenticatedUser } from '../../auth/meJson.js';
|
||||
import * as db from '../../../db/googleAuth.js';
|
||||
import { toPictureBuffer } from '../../../util/pictureBinary.js';
|
||||
|
||||
@@ -49,7 +49,7 @@ export function register(app, basePath = '') {
|
||||
try {
|
||||
const row = await db.getById(req.user.id);
|
||||
if (!row) {
|
||||
return meJson(res, 403, { error: 'User is no longer authorized' });
|
||||
return respondWithAuthenticatedUser(res, 403, { error: 'User is no longer authorized' });
|
||||
}
|
||||
|
||||
const pictureBinary = toPictureBuffer(row.pictureBinary);
|
||||
@@ -59,10 +59,10 @@ export function register(app, basePath = '') {
|
||||
selectedCompanyId: row.selectedCompanyId,
|
||||
...(pictureBinary && { picture: pictureBinary.toString('base64') }),
|
||||
};
|
||||
meJson(res, 200, { user });
|
||||
respondWithAuthenticatedUser(res, 200, { user });
|
||||
} catch (error) {
|
||||
console.error('Get current user failed:', error);
|
||||
meJson(res, 500, { error: 'Failed to load user' });
|
||||
respondWithAuthenticatedUser(res, 500, { error: 'Failed to load user' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user