Skip to content

Commit

Permalink
merge conflicts fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pks03 committed Apr 24, 2024
1 parent 5b464d3 commit aca4156
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions backend/src/routes/admin.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import prisma from '../db'
import { getAllPosts } from "../service/posts.service";
export const adminRouter = Router();



adminRouter.get("/allusers", async (req, res) => {
let currUserEmail = req.session.email;
let currUser;
Expand Down
2 changes: 1 addition & 1 deletion backend/src/routes/gauth.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ gauthRouter.get("/", async (req, res) => {
if (appUser.data) {
if (typeof appUser.data !== 'string' && appUser.data.role === "admin") {
logger.info("Admin login");
res.redirect(FRONTEND_URL + '/admin/home');
res.redirect(FRONTEND_URL + '/admin');
return;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const AdminHomepage = () => {
await axios.put(siteConfig.server_url + `/admin/promote/${usermail}`);
setMessage("User promoted to admin role")
// Refresh users list after promoting
const response = await axios.get(siteConfig.server_url + '/admin/home');
const response = await axios.get(siteConfig.server_url + '/admin');
if (response.status == HttpCodes.UNAUTHORIZED) {
window.location.href = "/";
return;
Expand All @@ -128,7 +128,7 @@ const AdminHomepage = () => {
await axios.put(siteConfig.server_url + `/admin/demote/${usermail}`);
setMessage("User demoted to default role")
// Refresh users list after promoting
const response = await axios.get(siteConfig.server_url + '/admin/home');
const response = await axios.get(siteConfig.server_url + '/admin');
if (response.status == HttpCodes.UNAUTHORIZED) {
window.location.href = "/";
return;
Expand Down

0 comments on commit aca4156

Please sign in to comment.