Skip to content

Commit

Permalink
feat: added rootFolderId (uuid) to refresh endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
apsantiso committed Oct 23, 2024
1 parent 8aeb5eb commit 36b1e09
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import UsersReferralsRoutes from './usersReferrals';
import NewsletterRoutes from './newsletter';
import UserRoutes from './user';
import AnalyticsRoutes from './analytics';
import { Sign, passportAuth } from '../middleware/passport';
import { Sign, passportAuth, SignNewToken } from '../middleware/passport';
import logger from '../../lib/logger';
import * as ReCaptchaV3 from '../../lib/recaptcha';
import * as AnalyticsService from '../../lib/analytics/AnalyticsService';
Expand Down Expand Up @@ -71,12 +71,16 @@ export default (router: Router, service: any, App: any): Router => {
}

const token = Sign(userData.email, App.config.get('secrets').JWT, true);
const newToken = SignNewToken(userData, App.config.get('secrets').JWT, true);

const rootFolder = await service.Folder.getById(userData.root_folder_id);

const user = {
email: userData.email,
userId: userData.userId,
mnemonic: userData.mnemonic,
root_folder_id: userData.root_folder_id,
rootFolderId: rootFolder?.uuid,
name: userData.name,
lastname: userData.lastname,
uuid: userData.uuid,
Expand All @@ -99,7 +103,7 @@ export default (router: Router, service: any, App: any): Router => {
lastPasswordChangedAt: userData.lastPasswordChangedAt,
};

res.status(200).json({ user, token });
res.status(200).json({ user, token, newToken });
});

router.post('/initialize', async (req, res) => {
Expand Down

0 comments on commit 36b1e09

Please sign in to comment.