mirror of https://github.com/fantasticit/think.git
fix #56
This commit is contained in:
parent
b28b4df011
commit
21595b9c83
|
@ -25,9 +25,8 @@ const { Text } = Typography;
|
||||||
export const TemplateEditor: React.FC<IProps> = ({ templateId }) => {
|
export const TemplateEditor: React.FC<IProps> = ({ templateId }) => {
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
const { data, loading, error, updateTemplate, deleteTemplate } = useTemplate(templateId);
|
const { data, loading, error, updateTemplate, deleteTemplate } = useTemplate(templateId);
|
||||||
|
|
||||||
const { width: windowWidth } = useWindowSize();
|
const { width: windowWidth } = useWindowSize();
|
||||||
const [title, setTitle] = useState(data.title);
|
const [title, setTitle] = useState(data && data.title);
|
||||||
const [isPublic, setPublic] = useState(false);
|
const [isPublic, setPublic] = useState(false);
|
||||||
const { width, fontSize } = useDocumentStyle();
|
const { width, fontSize } = useDocumentStyle();
|
||||||
const editorWrapClassNames = useMemo(() => {
|
const editorWrapClassNames = useMemo(() => {
|
||||||
|
@ -47,6 +46,7 @@ export const TemplateEditor: React.FC<IProps> = ({ templateId }) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
setPublic(data.isPublic);
|
setPublic(data.isPublic);
|
||||||
|
setTitle(data.title);
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue