Skip to content

Commit

Permalink
fix empty content bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dickeyy committed Jun 2, 2024
1 parent 9a26c5b commit 4772a07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 62 deletions.
9 changes: 6 additions & 3 deletions apps/api/src/routes/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ docs.ws("/ws", {
message: t.String(),
data: t.Object({
doc_id: t.String(),
content_to_save: t.Optional(t.String()),
content_to_save: t.Optional(
t.String({
minLength: 0
})
),
title: t.Optional(t.String())
}),
token: t.String()
Expand All @@ -35,14 +39,13 @@ docs.ws("/ws", {
}

if (message === "update content") {
if (data.content_to_save) {
if (data.content_to_save !== undefined) {
const doc = await updateDocumentByID(data.doc_id, data.content_to_save);
if (!doc) {
ws.send({
message: "error"
});
} else {
console.log("success");
ws.send({
message: "success",
doc: doc[0]
Expand Down
1 change: 0 additions & 1 deletion apps/web/app/entry/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import Document from "@/components/document";
import Spinner from "@/components/ui/spinner";
import WebSocketDemo from "@/components/websocket";
import useClerkSWR from "@/lib/clerk-swr";
import useDocumentStore from "@/stores/document-store";
import { redirect } from "next/navigation";
Expand Down
58 changes: 0 additions & 58 deletions apps/web/components/websocket.tsx

This file was deleted.

0 comments on commit 4772a07

Please sign in to comment.