fix: sign-event api working

This commit is contained in:
MTG2000
2022-07-20 19:41:30 +03:00
parent 263e8c410d
commit 41b8ff40c6
4 changed files with 11 additions and 12 deletions

View File

@@ -87,7 +87,7 @@ export default function AddComment({ initialContent, placeholder, name, autoFocu
const submitComment = () => {
onSubmit?.(valueRef.current);
// manager.view.updateState(manager.createState({ content: manager.createEmptyDoc() }))
manager.view.updateState(manager.createState({ content: manager.createEmptyDoc() }))
}

View File

@@ -1,3 +1,4 @@
import { marked } from "marked";
import { BiComment } from "react-icons/bi";
import VotesCount from "src/Components/VotesCount/VotesCount";
import Header from "src/features/Posts/Components/PostCard/Header/Header";
@@ -13,8 +14,8 @@ export default function CommentCard({ comment, onReply }: Props) {
return (
<div className="border rounded-12 p-24">
<Header author={comment.author} date={new Date(comment.created_at).toISOString()} />
<p className="text-body4 mt-16">
{comment.body}
<p className="text-body4 mt-16 whitespace-pre-line" dangerouslySetInnerHTML={{ __html: marked.parse(comment.body) }}>
</p>
<div className="flex gap-24 mt-16 items-center">
<VotesCount count={0} />

View File

@@ -77,8 +77,11 @@ const getSignedEvents = async (event: any) => {
const res = await fetch(CONSTS.apiEndpoint + '/sign-event', {
method: "post",
body: JSON.stringify({ event }),
credentials: 'include'
})
credentials: 'include',
headers: {
'Content-Type': 'application/json'
},
});
const data = await res.json()
return data.event;
}
@@ -110,8 +113,6 @@ export async function post(data: string, filter: string) {
tags: [['r', filter]],
content: data
}) as NostrEvent;
console.log(event);
return;
} catch (error) {
alert("Couldn't sign the object successfully...")
return;
@@ -197,7 +198,7 @@ export async function constructTree() {
// (nothing for now -:-)
// Turn the top roots replies into a sorted array
const sortedTree = Object.values(eventsTree).sort((a, b) => a.created_at - b.created_at)
const sortedTree = Object.values(eventsTree).sort((a, b) => b.created_at - a.created_at)
// Publish the new tree.
return sortedTree;