Новые правки
This commit is contained in:
parent
79db7c8563
commit
a5f208a132
19 changed files with 852 additions and 1 deletions
|
|
@ -34,14 +34,31 @@ export default function Comments(props: CommentsProps) {
|
|||
|
||||
onMount(async () => {
|
||||
try {
|
||||
const response = await fetch("/api/auth/me", {
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), 5000);
|
||||
|
||||
const url = new URL("/api/auth/me", window.location.origin);
|
||||
const response = await fetch(url.toString(), {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
console.log("[Comments] Auth response status:", response.status);
|
||||
|
||||
if (!response.ok) {
|
||||
console.log("[Comments] Auth response not ok, staying unauthenticated");
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log("[Comments] Auth data:", data);
|
||||
|
||||
if (data.authenticated && data.user) {
|
||||
console.log("[Comments] User authenticated:", data.user.name);
|
||||
setIsAuthenticated(true);
|
||||
setCurrentUser({
|
||||
id: data.user.id,
|
||||
|
|
@ -49,9 +66,12 @@ export default function Comments(props: CommentsProps) {
|
|||
email: data.user.email,
|
||||
avatar: data.user.avatar,
|
||||
});
|
||||
} else {
|
||||
console.log("[Comments] User NOT authenticated");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[Comments] Ошибка проверки авторизации:", error);
|
||||
setIsAuthenticated(false);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,6 +133,10 @@ const heroImage = getPostImageUrl(post);
|
|||
font-size: 1.05rem;
|
||||
}
|
||||
|
||||
.post-content :global(p:first-of-type) {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.post-content :global(ul), .post-content :global(ol) {
|
||||
margin: 1rem 0;
|
||||
padding-left: 1.5rem;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,18 @@ html {
|
|||
--color-light: #ffffff;
|
||||
}
|
||||
|
||||
/* Отступ сверху для контента статей */
|
||||
.post-content > p:first-child,
|
||||
.post-content > div:first-child > p:first-child {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
/* Первый H2 - видимый */
|
||||
.post-content > h2:first-of-type {
|
||||
display: block !important;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue