Skip to content

Commit 5e02e2b

Browse files
authored
Merge pull request #568 from velopert/fix/temp-save
fix: Improve temp save functionality and remove notification when auto save
2 parents a45be44 + 4b98e9b commit 5e02e2b

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/containers/write/MarkdownEditorContainer.tsx

+7-9
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,18 @@ const MarkdownEditorContainer: React.FC<MarkdownEditorContainerProps> = () => {
150150

151151
const onTempSave = useCallback(
152152
async (notify?: boolean) => {
153-
console.log('onTempSave');
153+
const notifySuccess = () => {
154+
if (!notify) return;
155+
toast.success('포스트가 임시저장되었습니다.');
156+
};
154157

155158
if (isWritePostLoading || isEditPostLoading) return;
156159
if (!title || !markdown) {
157160
toast.error('제목 또는 내용이 비어있습니다.');
158161
return;
159162
}
160163

161-
const notifySuccess = () => {
162-
if (!notify) return;
163-
toast.success('포스트가 임시저장되었습니다.');
164-
};
165-
166164
if (!postId) {
167-
console.log('writePost');
168165
const response = await writePost({
169166
variables: {
170167
title,
@@ -189,7 +186,7 @@ const MarkdownEditorContainer: React.FC<MarkdownEditorContainerProps> = () => {
189186
}
190187

191188
// tempsaving unreleased post:
192-
if (isTemp && postId) {
189+
if (postId) {
193190
await editPost({
194191
variables: {
195192
id: postId,
@@ -282,6 +279,7 @@ const MarkdownEditorContainer: React.FC<MarkdownEditorContainerProps> = () => {
282279
dispatch(setWritePostId(id));
283280
history.replace(`/write?id=${id}`);
284281
}
282+
285283
if (!id) return;
286284

287285
const url = URL.createObjectURL(file);
@@ -312,7 +310,7 @@ const MarkdownEditorContainer: React.FC<MarkdownEditorContainerProps> = () => {
312310

313311
const timeoutId = setTimeout(() => {
314312
if (!postId && !title && markdown.length < 30) return;
315-
onTempSave(true);
313+
onTempSave(false);
316314
}, 1000 * 10);
317315

318316
return () => {

0 commit comments

Comments
 (0)