feat(dashboard): add aggregated dashboard stats API, robust logout, and warehouse seeders
deploy-chabokan / deploy (push) Canceled after 0s

This commit is contained in:
2026-08-30 09:29:21 +03:30
parent 9b88b342ad
commit 576ccf5421
8 changed files with 457 additions and 11 deletions
+17 -11
View File
@@ -39,20 +39,26 @@ exports.loginUser = catchAsync(async (req, res, next) => {
})
exports.logoutUser = catchAsync(async (req, res, next) => {
res.cookie('belonging_token', '', {
httpOnly: true,
maxAge: 0,
path: '/',
})
res.cookie('bm-token', '', {
httpOnly: false,
maxAge: 0,
path: '/',
})
const isProduction = process.env.NODE_ENV === 'production'
// Clear default host cookies
res.clearCookie('belonging_token', { path: '/' })
res.clearCookie('bm-token', { path: '/' })
res.clearCookie('jwt', { path: '/' })
// Clear domain cookies if in production or mbmanager domain
if (isProduction || req.hostname.includes('mbmanager.ir')) {
res.clearCookie('belonging_token', { domain: '.mbmanager.ir', path: '/' })
res.clearCookie('bm-token', { domain: '.mbmanager.ir', path: '/' })
res.clearCookie('jwt', { domain: '.mbmanager.ir', path: '/' })
}
res.cookie('belonging_token', '', { maxAge: 0, expires: new Date(0), path: '/' })
res.cookie('bm-token', '', { maxAge: 0, expires: new Date(0), path: '/' })
res.status(200).json({
status: 'success',
message: 'کاربر خارج شد',
message: 'کاربر با موفقیت خارج شد',
})
})