import { Button, Form, Input, message } from 'antd';
import React from 'react';
import { useParams } from 'react-router';
import {
updateWorkspaceWebsiteInfo,
useWorkspaceWebsiteInfo,
} from '../api/model/website';
import { useRequest } from '../hooks/useRequest';
import { useCurrentWorkspaceId } from '../store/user';
import { ErrorTip } from './ErrorTip';
import { Loading } from './Loading';
import { NoWorkspaceTip } from './NoWorkspaceTip';
export const WebsiteInfo: React.FC = React.memo(() => {
const { websiteId } = useParams<{
websiteId: string;
}>();
const currentWorkspaceId = useCurrentWorkspaceId();
const { website, isLoading } = useWorkspaceWebsiteInfo(
currentWorkspaceId!,
websiteId!
);
const [, handleSave] = useRequest(
async (values: { name: string; domain: string }) => {
await updateWorkspaceWebsiteInfo(currentWorkspaceId!, websiteId!, {
name: values.name,
domain: values.domain,
});
message.success('Save Success');
}
);
if (!currentWorkspaceId) {
return