fixed routing issue and draft page not loading
This commit is contained in:
parent
6d9b245f3c
commit
05ce0c052d
@ -1,7 +1,7 @@
|
||||
import './Header.css';
|
||||
import UserMenu from './UserMenu';
|
||||
|
||||
function Header({ currentUser, onLogout, onOpenAdminPanel }) {
|
||||
function Header({ currentUser, onLogout, onOpenAdminPanel, onOpenMyDrafts }) {
|
||||
return (
|
||||
<header className='header'>
|
||||
<div className='header-content'>
|
||||
@ -11,6 +11,7 @@ function Header({ currentUser, onLogout, onOpenAdminPanel }) {
|
||||
currentUser={currentUser}
|
||||
onLogout={onLogout}
|
||||
onOpenAdminPanel={onOpenAdminPanel}
|
||||
onOpenMyDrafts={onOpenMyDrafts}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@ -62,6 +62,16 @@ initDb().then(() => {
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/articles/drafts', authenticateToken, authorizeRoles('Admin', 'Editor'), (req, res) => {
|
||||
try {
|
||||
const drafts = getOwnedDrafts(req.user.display_name);
|
||||
res.json(drafts);
|
||||
} catch(error) {
|
||||
console.error('Error fetching owned drafts', error);
|
||||
res.status(500).json({error: 'Failed to fetch owned drafts', details: String(error)});
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/articles/:ka_number', authenticateToken, (req, res) => {
|
||||
try {
|
||||
const article = getArticle(req.params.ka_number);
|
||||
@ -358,16 +368,6 @@ initDb().then(() => {
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/articles/drafts', authenticateToken, authorizeRoles('Admin', 'Editor'), (req, res) => {
|
||||
try {
|
||||
const drafts = getOwnedDrafts(req.user.display_name);
|
||||
res.json(drafts);
|
||||
} catch(error) {
|
||||
console.error('Error fetching owned drafts', error);
|
||||
res.status(500).json({error: 'Failed to fetch owned drafts', details: String(error)});
|
||||
}
|
||||
});
|
||||
|
||||
app.post('/api/articles/:ka_number/media',
|
||||
authenticateToken,
|
||||
authorizeRoles('Admin', 'Editor'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user