fixe lougout btn
This commit is contained in:
parent
3e478b3574
commit
e5c238f88c
@ -12,11 +12,6 @@
|
|||||||
],
|
],
|
||||||
"rootMainFiles": [],
|
"rootMainFiles": [],
|
||||||
"pages": {
|
"pages": {
|
||||||
"/": [
|
|
||||||
"static/chunks/webpack.js",
|
|
||||||
"static/chunks/main.js",
|
|
||||||
"static/chunks/pages/index.js"
|
|
||||||
],
|
|
||||||
"/_app": [
|
"/_app": [
|
||||||
"static/chunks/webpack.js",
|
"static/chunks/webpack.js",
|
||||||
"static/chunks/main.js",
|
"static/chunks/main.js",
|
||||||
@ -41,11 +36,6 @@
|
|||||||
"static/chunks/webpack.js",
|
"static/chunks/webpack.js",
|
||||||
"static/chunks/main.js",
|
"static/chunks/main.js",
|
||||||
"static/chunks/pages/blog/[slug].js"
|
"static/chunks/pages/blog/[slug].js"
|
||||||
],
|
|
||||||
"/devlog": [
|
|
||||||
"static/chunks/webpack.js",
|
|
||||||
"static/chunks/main.js",
|
|
||||||
"static/chunks/pages/devlog.js"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ampFirstPages": []
|
"ampFirstPages": []
|
||||||
|
|||||||
BIN
.next/cache/webpack/client-development/10.pack.gz
vendored
BIN
.next/cache/webpack/client-development/10.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/11.pack.gz
vendored
BIN
.next/cache/webpack/client-development/11.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/12.pack.gz
vendored
BIN
.next/cache/webpack/client-development/12.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/13.pack.gz
vendored
BIN
.next/cache/webpack/client-development/13.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/2.pack.gz
vendored
BIN
.next/cache/webpack/client-development/2.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/7.pack.gz
vendored
BIN
.next/cache/webpack/client-development/7.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/8.pack.gz
vendored
BIN
.next/cache/webpack/client-development/8.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/9.pack.gz
vendored
BIN
.next/cache/webpack/client-development/9.pack.gz
vendored
Binary file not shown.
Binary file not shown.
BIN
.next/cache/webpack/server-development/11.pack.gz
vendored
BIN
.next/cache/webpack/server-development/11.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/12.pack.gz
vendored
BIN
.next/cache/webpack/server-development/12.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/13.pack.gz
vendored
BIN
.next/cache/webpack/server-development/13.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/3.pack.gz
vendored
BIN
.next/cache/webpack/server-development/3.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/5.pack.gz
vendored
BIN
.next/cache/webpack/server-development/5.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/8.pack.gz
vendored
BIN
.next/cache/webpack/server-development/8.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/index.pack.gz
vendored
BIN
.next/cache/webpack/server-development/index.pack.gz
vendored
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
self.__BUILD_MANIFEST={"polyfillFiles":["static/chunks/polyfills.js"],"devFiles":["static/chunks/react-refresh.js"],"ampDevFiles":[],"lowPriorityFiles":["static/development/_buildManifest.js","static/development/_ssgManifest.js"],"rootMainFiles":[],"pages":{"/":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/index.js"],"/_app":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_app.js"],"/_error":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_error.js"],"/admin":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/admin.js"],"/admin/login":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/admin/login.js"],"/blog/[slug]":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/blog/[slug].js"],"/devlog":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/devlog.js"]},"ampFirstPages":[]}
|
self.__BUILD_MANIFEST={"polyfillFiles":["static/chunks/polyfills.js"],"devFiles":["static/chunks/react-refresh.js"],"ampDevFiles":[],"lowPriorityFiles":["static/development/_buildManifest.js","static/development/_ssgManifest.js"],"rootMainFiles":[],"pages":{"/_app":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_app.js"],"/_error":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_error.js"],"/admin":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/admin.js"],"/admin/login":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/admin/login.js"],"/blog/[slug]":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/blog/[slug].js"]},"ampFirstPages":[]}
|
||||||
@ -4,8 +4,6 @@
|
|||||||
"/_document": "pages/_document.js",
|
"/_document": "pages/_document.js",
|
||||||
"/admin": "pages/admin.js",
|
"/admin": "pages/admin.js",
|
||||||
"/devlog": "pages/devlog.js",
|
"/devlog": "pages/devlog.js",
|
||||||
"/blog/[slug]": "pages/blog/[slug].js",
|
|
||||||
"/admin/login": "pages/admin/login.js",
|
"/admin/login": "pages/admin/login.js",
|
||||||
"/api/logout": "pages/api/logout.js",
|
"/blog/[slug]": "pages/blog/[slug].js"
|
||||||
"/": "pages/index.js"
|
|
||||||
}
|
}
|
||||||
@ -1 +1 @@
|
|||||||
self.__BUILD_MANIFEST = {__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static\u002Fchunks\u002Fpages\u002Findex.js"],"/_error":["static\u002Fchunks\u002Fpages\u002F_error.js"],"/admin":["static\u002Fchunks\u002Fpages\u002Fadmin.js"],"/admin/login":["static\u002Fchunks\u002Fpages\u002Fadmin\u002Flogin.js"],"/blog/[slug]":["static\u002Fchunks\u002Fpages\u002Fblog\u002F[slug].js"],"/devlog":["static\u002Fchunks\u002Fpages\u002Fdevlog.js"],sortedPages:["\u002F","\u002F_app","\u002F_error","\u002Fadmin","\u002Fadmin\u002Flogin","\u002Fblog\u002F[slug]","\u002Fdevlog"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()
|
self.__BUILD_MANIFEST = {__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static\u002Fchunks\u002Fpages\u002F_error.js"],"/admin":["static\u002Fchunks\u002Fpages\u002Fadmin.js"],"/admin/login":["static\u002Fchunks\u002Fpages\u002Fadmin\u002Flogin.js"],"/blog/[slug]":["static\u002Fchunks\u002Fpages\u002Fblog\u002F[slug].js"],sortedPages:["\u002F_app","\u002F_error","\u002Fadmin","\u002Fadmin\u002Flogin","\u002Fblog\u002F[slug]"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()
|
||||||
12
.next/trace
12
.next/trace
File diff suppressed because one or more lines are too long
@ -74,6 +74,32 @@ export default function AdminPanel() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDelete = async (entryId, entryTitle) => {
|
||||||
|
if (!confirm(`Sind Sie sicher, dass Sie den Beitrag "${entryTitle}" löschen möchten?`)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/delete-devlog', {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ id: entryId }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorData = await response.json();
|
||||||
|
throw new Error(errorData.error || 'Fehler beim Löschen');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reload data from Supabase to get updated entries
|
||||||
|
await loadEntries();
|
||||||
|
alert('Beitrag erfolgreich gelöscht!');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Fehler beim Löschen:', error);
|
||||||
|
alert(`Fehler beim Löschen des Beitrags: ${error.message}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const EntryForm = ({ entry, onSave }) => {
|
const EntryForm = ({ entry, onSave }) => {
|
||||||
const [formData, setFormData] = useState(entry);
|
const [formData, setFormData] = useState(entry);
|
||||||
const [contentList, setContentList] = useState(entry.content || []);
|
const [contentList, setContentList] = useState(entry.content || []);
|
||||||
@ -212,12 +238,20 @@ export default function AdminPanel() {
|
|||||||
<h2 className="text-xl font-bold">{entry.title}</h2>
|
<h2 className="text-xl font-bold">{entry.title}</h2>
|
||||||
<p className="text-gray-600">{entry.date}</p>
|
<p className="text-gray-600">{entry.date}</p>
|
||||||
<p className="mb-4">{entry.description}</p>
|
<p className="mb-4">{entry.description}</p>
|
||||||
<button
|
<div className="flex space-x-2">
|
||||||
onClick={() => setSelectedEntry({ ...entry, editIndex: index })}
|
<button
|
||||||
className="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
|
onClick={() => setSelectedEntry({ ...entry, editIndex: index })}
|
||||||
>
|
className="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
|
||||||
Bearbeiten
|
>
|
||||||
</button>
|
Bearbeiten
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={() => handleDelete(entry.id, entry.title)}
|
||||||
|
className="px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600"
|
||||||
|
>
|
||||||
|
Löschen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
37
pages/api/delete-devlog.js
Normal file
37
pages/api/delete-devlog.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { supabase } from '../../lib/supabase';
|
||||||
|
|
||||||
|
export default async function handler(req, res) {
|
||||||
|
if (req.method !== 'DELETE') {
|
||||||
|
return res.status(405).json({ error: 'Method not allowed' });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authentication überprüfen
|
||||||
|
const isAuthenticated = req.cookies.isAuthenticated === 'true';
|
||||||
|
if (!isAuthenticated) {
|
||||||
|
return res.status(401).json({ error: 'Unauthorized' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const { id } = req.body;
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
|
return res.status(400).json({ error: 'ID ist erforderlich' });
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Beitrag aus Supabase löschen
|
||||||
|
const { error } = await supabase
|
||||||
|
.from('devlog_entries')
|
||||||
|
.delete()
|
||||||
|
.eq('id', id);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
console.error('Supabase Lösch-Fehler:', error);
|
||||||
|
return res.status(500).json({ error: 'Fehler beim Löschen des Beitrags' });
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.status(200).json({ message: 'Beitrag erfolgreich gelöscht' });
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Server-Fehler:', error);
|
||||||
|
return res.status(500).json({ error: 'Interner Server-Fehler' });
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user