Skip to content
2 changes: 1 addition & 1 deletion app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function App() {
<Route path="/admin/xen" element={<XENPostView />} />
<Route path="/admin/ae" element={<AEPostView />} />
<Route path="/admin/je" element={<JEPostView />} />
<Route path="/admin/:adminType/posts/:role/:post_id" element={<AdminPostView />} />
<Route path="/admin/posts/:role/:post_id" element={<AdminPostView />} />
</Routes>
</Router>
);
Expand Down
2 changes: 1 addition & 1 deletion app/src/pages/admin/AEPostView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function PostTile({ label, icon, role, posts }: PostTileProps) {
{posts.map((post) => (
<li key={post.id}>
<Link
to={`/admin/ae/posts/${role}/${post.id}`}
to={`/admin/posts/${role}/${post.id}`}
className="flex items-center gap-4 px-5 py-3.5 hover:bg-gray-50 transition-colors cursor-pointer"
>
{/* ID chip */}
Expand Down
4 changes: 3 additions & 1 deletion app/src/pages/admin/AdminPostView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ function MetaRow({ icon, label, value }: { icon: React.ReactNode; label: string;
// ── Page ───────────────────────────────────────────────────────────────────────

export function AdminPostView() {
const { adminType, role, post_id } = useParams<{ adminType: string; role: string; post_id: string }>();
const { role, post_id } = useParams<{ role: string; post_id: string }>();
const adminPosition = sessionStorage.getItem('adminPosition') ?? '';
const adminType = adminPosition.startsWith('XEN') ? 'xen' : adminPosition.startsWith('AE') ? 'ae' : adminPosition.startsWith('JE') ? 'je' : '';
const navigate = useNavigate();

const [post, setPost] = useState<Post | null>(null);
Expand Down
2 changes: 1 addition & 1 deletion app/src/pages/admin/JEPostView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function PostTile({ label, icon, role, posts }: PostTileProps) {
{posts.map((post) => (
<li key={post.id}>
<Link
to={`/admin/je/posts/${role}/${post.id}`}
to={`/admin/posts/${role}/${post.id}`}
className="flex items-center gap-4 px-5 py-3.5 hover:bg-gray-50 transition-colors cursor-pointer"
>
{/* ID chip */}
Expand Down
2 changes: 1 addition & 1 deletion app/src/pages/admin/XENPostView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function PostTile({ label, icon, role, posts }: PostTileProps) {
{posts.map((post) => (
<li key={post.id}>
<Link
to={`/admin/xen/posts/${role}/${post.id}`}
to={`/admin/posts/${role}/${post.id}`}
className="flex items-center gap-4 px-5 py-3.5 hover:bg-gray-50 transition-colors cursor-pointer"
>
{/* ID chip */}
Expand Down
1 change: 1 addition & 0 deletions app/src/pages/auth/StaffLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function StaffLogin() {
setStatus('error');
setMessage(`Unknown position "${data.position}" — contact admin.`);
} else {
sessionStorage.setItem('adminPosition', data.position ?? '');
navigate(dest);
}
} else {
Expand Down
8 changes: 4 additions & 4 deletions handlers/admin_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ func (h *AdminHandler) AdminLogin (c *gin.Context) {
return
}

// if admin.IsVerified == false {
// c.JSON(401, gin.H{"error": "unverified user"})
// return
// }
if admin.IsVerified == false {
c.JSON(401, gin.H{"error": "unverified user"})
return
}

err := bcrypt.CompareHashAndPassword([]byte(admin.Password), []byte(inputs.Password))
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions handlers/admin_post.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,10 @@ func (h* AdminHandler) GetJEPosts (c *gin.Context) {
})
}

// for now we treat 404 and 500 during fetching post the same
func (h *AdminHandler) AdminGetPost (c *gin.Context) {

// AdminGetPost fetches the whole post page for any admin
// (for now we treat 404 and 500 during fetching post the same)
func (h *AdminHandler) AdminGetPost(c *gin.Context) {

// get email from gin context
email, exists := c.Get(middleware.EmailKey)
Expand Down
Loading
Loading