fix: add missing newlines at the end of JSON files; clean up formatting in page components
This commit is contained in:
@@ -5,7 +5,6 @@ import { useTransition } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { toast } from '@kit/ui/sonner';
|
||||
|
||||
import {
|
||||
AlertDialog,
|
||||
@@ -19,6 +18,7 @@ import {
|
||||
AlertDialogTrigger,
|
||||
} from '@kit/ui/alert-dialog';
|
||||
import { Button } from '@kit/ui/button';
|
||||
import { toast } from '@kit/ui/sonner';
|
||||
|
||||
interface PublishToggleButtonProps {
|
||||
pageId: string;
|
||||
@@ -38,11 +38,14 @@ export function PublishToggleButton({
|
||||
const handleToggle = () => {
|
||||
startTransition(async () => {
|
||||
try {
|
||||
const response = await fetch(`/api/site-builder/pages/${pageId}/publish`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ accountId, isPublished: !isPublished }),
|
||||
});
|
||||
const response = await fetch(
|
||||
`/api/site-builder/pages/${pageId}/publish`,
|
||||
{
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ accountId, isPublished: !isPublished }),
|
||||
},
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
toast.error(t('pages.toggleError'));
|
||||
|
||||
Reference in New Issue
Block a user