Blog seite Fiexed
This commit is contained in:
parent
4721b59b10
commit
9dfb001fc9
@ -12,11 +12,6 @@
|
||||
],
|
||||
"rootMainFiles": [],
|
||||
"pages": {
|
||||
"/": [
|
||||
"static/chunks/webpack.js",
|
||||
"static/chunks/main.js",
|
||||
"static/chunks/pages/index.js"
|
||||
],
|
||||
"/_app": [
|
||||
"static/chunks/webpack.js",
|
||||
"static/chunks/main.js",
|
||||
@ -26,6 +21,16 @@
|
||||
"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/blog": [
|
||||
"static/chunks/webpack.js",
|
||||
"static/chunks/main.js",
|
||||
"static/chunks/pages/admin/blog.js"
|
||||
]
|
||||
},
|
||||
"ampFirstPages": []
|
||||
|
||||
BIN
.next/cache/webpack/client-development/0.pack.gz
vendored
BIN
.next/cache/webpack/client-development/0.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/1.pack.gz
vendored
BIN
.next/cache/webpack/client-development/1.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/3.pack.gz
vendored
BIN
.next/cache/webpack/client-development/3.pack.gz
vendored
Binary file not shown.
Binary file not shown.
BIN
.next/cache/webpack/server-development/0.pack.gz
vendored
BIN
.next/cache/webpack/server-development/0.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/1.pack.gz
vendored
BIN
.next/cache/webpack/server-development/1.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/server-development/2.pack.gz
vendored
BIN
.next/cache/webpack/server-development/2.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/4.pack.gz
vendored
BIN
.next/cache/webpack/server-development/4.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/index.pack.gz
vendored
BIN
.next/cache/webpack/server-development/index.pack.gz
vendored
Binary file not shown.
Binary file not shown.
@ -1 +1,18 @@
|
||||
{}
|
||||
{
|
||||
"..\\node_modules\\@supabase\\auth-js\\dist\\module\\lib\\helpers.js -> @supabase/node-fetch": {
|
||||
"id": "..\\node_modules\\@supabase\\auth-js\\dist\\module\\lib\\helpers.js -> @supabase/node-fetch",
|
||||
"files": []
|
||||
},
|
||||
"..\\node_modules\\@supabase\\functions-js\\dist\\module\\helper.js -> @supabase/node-fetch": {
|
||||
"id": "..\\node_modules\\@supabase\\functions-js\\dist\\module\\helper.js -> @supabase/node-fetch",
|
||||
"files": []
|
||||
},
|
||||
"..\\node_modules\\@supabase\\realtime-js\\dist\\module\\RealtimeClient.js -> @supabase/node-fetch": {
|
||||
"id": "..\\node_modules\\@supabase\\realtime-js\\dist\\module\\RealtimeClient.js -> @supabase/node-fetch",
|
||||
"files": []
|
||||
},
|
||||
"..\\node_modules\\@supabase\\storage-js\\dist\\module\\lib\\helpers.js -> @supabase/node-fetch": {
|
||||
"id": "..\\node_modules\\@supabase\\storage-js\\dist\\module\\lib\\helpers.js -> @supabase/node-fetch",
|
||||
"files": []
|
||||
}
|
||||
}
|
||||
@ -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"]},"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/blog":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/admin/blog.js"]},"ampFirstPages":[]}
|
||||
@ -1,6 +1,25 @@
|
||||
{
|
||||
"sortedMiddleware": [],
|
||||
"middleware": {},
|
||||
"sortedMiddleware": [
|
||||
"/"
|
||||
],
|
||||
"middleware": {
|
||||
"/": {
|
||||
"files": [
|
||||
"server/edge-runtime-webpack.js",
|
||||
"server/middleware.js"
|
||||
],
|
||||
"name": "middleware",
|
||||
"page": "/",
|
||||
"matchers": [
|
||||
{
|
||||
"regexp": "^/.*$",
|
||||
"originalSource": "/:path*"
|
||||
}
|
||||
],
|
||||
"wasm": [],
|
||||
"assets": []
|
||||
}
|
||||
},
|
||||
"functions": {},
|
||||
"version": 2
|
||||
}
|
||||
@ -1 +1 @@
|
||||
self.__REACT_LOADABLE_MANIFEST="{}"
|
||||
self.__REACT_LOADABLE_MANIFEST="{\"..\\\\node_modules\\\\@supabase\\\\auth-js\\\\dist\\\\module\\\\lib\\\\helpers.js -> @supabase/node-fetch\":{\"id\":\"..\\\\node_modules\\\\@supabase\\\\auth-js\\\\dist\\\\module\\\\lib\\\\helpers.js -> @supabase/node-fetch\",\"files\":[]},\"..\\\\node_modules\\\\@supabase\\\\functions-js\\\\dist\\\\module\\\\helper.js -> @supabase/node-fetch\":{\"id\":\"..\\\\node_modules\\\\@supabase\\\\functions-js\\\\dist\\\\module\\\\helper.js -> @supabase/node-fetch\",\"files\":[]},\"..\\\\node_modules\\\\@supabase\\\\realtime-js\\\\dist\\\\module\\\\RealtimeClient.js -> @supabase/node-fetch\":{\"id\":\"..\\\\node_modules\\\\@supabase\\\\realtime-js\\\\dist\\\\module\\\\RealtimeClient.js -> @supabase/node-fetch\",\"files\":[]},\"..\\\\node_modules\\\\@supabase\\\\storage-js\\\\dist\\\\module\\\\lib\\\\helpers.js -> @supabase/node-fetch\":{\"id\":\"..\\\\node_modules\\\\@supabase\\\\storage-js\\\\dist\\\\module\\\\lib\\\\helpers.js -> @supabase/node-fetch\",\"files\":[]}}"
|
||||
@ -2,5 +2,8 @@
|
||||
"/_app": "pages/_app.js",
|
||||
"/_error": "pages/_error.js",
|
||||
"/_document": "pages/_document.js",
|
||||
"/": "pages/index.js"
|
||||
"/": "pages/index.js",
|
||||
"/admin": "pages/admin.js",
|
||||
"/admin/blog": "pages/admin/blog.js",
|
||||
"/api/update-blog": "pages/api/update-blog.js"
|
||||
}
|
||||
@ -1 +1 @@
|
||||
self.__BUILD_MANIFEST = {__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static\u002Fchunks\u002Fpages\u002Findex.js"],"/_error":["static\u002Fchunks\u002Fpages\u002F_error.js"],sortedPages:["\u002F","\u002F_app","\u002F_error"]};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/blog":["static\u002Fchunks\u002Fpages\u002Fadmin\u002Fblog.js"],sortedPages:["\u002F_app","\u002F_error","\u002Fadmin","\u002Fadmin\u002Fblog"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()
|
||||
54
.next/trace
54
.next/trace
File diff suppressed because one or more lines are too long
@ -389,10 +389,9 @@ export default function BlogAdmin() {
|
||||
{content.type === 'text' && activeContentIndex === index && (
|
||||
<div className="border rounded-lg p-3 bg-gray-50">
|
||||
<div className="text-xs font-medium text-gray-600 mb-2">Vorschau:</div>
|
||||
<div className="prose prose-sm max-w-none">
|
||||
<div className="prose prose-sm max-w-none whitespace-pre-wrap">
|
||||
<ReactMarkdown
|
||||
remarkPlugins={[remarkGfm]}
|
||||
className="whitespace-pre-wrap"
|
||||
components={{
|
||||
p: ({children}) => <p className="mb-4 whitespace-pre-wrap">{children}</p>,
|
||||
code: ({node, inline, className, children, ...props}) => {
|
||||
|
||||
@ -1,14 +1,18 @@
|
||||
import { supabase } from '../../lib/supabase';
|
||||
import { supabaseAdmin } from '../../lib/supabase';
|
||||
|
||||
export default async function handler(req, res) {
|
||||
if (req.method !== 'DELETE') {
|
||||
return res.status(405).json({ error: 'Method not allowed' });
|
||||
}
|
||||
|
||||
const isAuthenticated = req.cookies.isAuthenticated === 'true';
|
||||
if (!isAuthenticated) {
|
||||
// Get user from supabase session
|
||||
const { data: sessionData, error: authError } = await supabaseAdmin.auth.getUser(req.cookies['sb-access-token']);
|
||||
|
||||
if (authError || !sessionData?.user) {
|
||||
return res.status(401).json({ error: 'Unauthorized' });
|
||||
}
|
||||
|
||||
const user = sessionData.user;
|
||||
|
||||
const { id } = req.body;
|
||||
|
||||
@ -17,10 +21,11 @@ export default async function handler(req, res) {
|
||||
}
|
||||
|
||||
try {
|
||||
const { error } = await supabase
|
||||
const { error } = await supabaseAdmin
|
||||
.from('blog_entries')
|
||||
.delete()
|
||||
.eq('id', id);
|
||||
.eq('id', id)
|
||||
.eq('author_id', user.id);
|
||||
|
||||
if (error) {
|
||||
console.error('Supabase Lösch-Fehler:', error);
|
||||
|
||||
@ -6,30 +6,38 @@ export default async function handler(req, res) {
|
||||
return res.status(405).json({ error: 'Method not allowed' });
|
||||
}
|
||||
|
||||
try {
|
||||
const data = req.body;
|
||||
|
||||
if (!Array.isArray(data)) {
|
||||
console.log('Invalid data format - not an array');
|
||||
return res.status(400).json({ error: 'Data must be an array' });
|
||||
}
|
||||
try {
|
||||
// Get user from supabase session
|
||||
const { data: sessionData, error: authError } = await supabaseAdmin.auth.getUser(req.cookies['sb-access-token']);
|
||||
|
||||
if (authError || !sessionData?.user) {
|
||||
return res.status(401).json({ error: 'Unauthorized' });
|
||||
}
|
||||
|
||||
const user = sessionData.user;
|
||||
|
||||
const results = [];
|
||||
|
||||
for (const entry of data) {
|
||||
const content = Array.isArray(entry.content) ? entry.content : [];
|
||||
const data = req.body;
|
||||
|
||||
const cleanEntry = {
|
||||
title: entry.title || '',
|
||||
date: entry.date || '',
|
||||
description: entry.description || '',
|
||||
slug: entry.slug || '',
|
||||
image: entry.image || '',
|
||||
content: content,
|
||||
updated_at: new Date().toISOString()
|
||||
};
|
||||
if (!Array.isArray(data)) {
|
||||
console.log('Invalid data format - not an array');
|
||||
return res.status(400).json({ error: 'Data must be an array' });
|
||||
}
|
||||
|
||||
const results = [];
|
||||
|
||||
const { data: result, error } = await supabaseAdmin
|
||||
for (const entry of data) {
|
||||
const content = Array.isArray(entry.content) ? entry.content : [];
|
||||
|
||||
const cleanEntry = {
|
||||
title: entry.title || '',
|
||||
date: entry.date || '',
|
||||
description: entry.description || '',
|
||||
slug: entry.slug || '',
|
||||
image: entry.image || '',
|
||||
content: content,
|
||||
author_id: user.id,
|
||||
updated_at: new Date().toISOString()
|
||||
}; const { data: result, error } = await supabaseAdmin
|
||||
.from('blog_entries')
|
||||
.upsert(cleanEntry, {
|
||||
onConflict: 'slug',
|
||||
|
||||
@ -46,7 +46,6 @@ export default function BlogPost({ blog }) {
|
||||
<div key={index} className="prose prose-lg max-w-none">
|
||||
<ReactMarkdown
|
||||
remarkPlugins={[remarkGfm]}
|
||||
className="text-gray-700 text-base sm:text-lg leading-relaxed px-2 sm:px-0"
|
||||
components={{
|
||||
h1: ({children}) => <h1 className="text-3xl font-bold mb-4 text-gray-900">{children}</h1>,
|
||||
h2: ({children}) => <h2 className="text-2xl font-bold mb-3 text-gray-900">{children}</h2>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user