Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Fix variables for views after big SQL usage upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
kkamara committed Aug 15, 2023
1 parent a8a96c9 commit 47d589a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions public/admin/js/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use strict';

const run = async () => {
let res = null;
try {
const token = localStorage.getItem('auth');
if (null === token) {
window.location.href = domain+'/admin';
}
res = await axios.post(
const authResponse = await axios.post(
domain+'/admin/authenticate',
null,
{
Expand All @@ -16,12 +15,12 @@ const run = async () => {
},
},
);
const authData = res.data;
const authData = authResponse.data;
console.log(authData);
document.querySelector('.fullName')
.textContent = authData.data.auth.firstName + ' ' + authData.data.auth.lastName;

res = await axios.post(
const page = await axios.post(
domain+'/admin/dashboard',
null,
{
Expand All @@ -30,7 +29,7 @@ const run = async () => {
},
},
);
const dashboardData = res.data;
const dashboardData = page.data;
console.log(dashboardData);
document.querySelector('.usersCount')
.textContent = dashboardData.data.usersCount;
Expand Down
2 changes: 1 addition & 1 deletion src/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = (sequelize, DataTypes) => {
`SELECT count(Users.uid) as usersCount
FROM Users;`,
);
res = { usersCount: results[0].users_count, }
res = { usersCount: results[0].usersCount, }
return { ...res, }
} catch(err) {
return res;
Expand Down

0 comments on commit 47d589a

Please sign in to comment.