fix post commnet
This commit is contained in:
@ -46,8 +46,13 @@ export default function CommentForm({ user, agent, onCommentPosted }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post the record
|
// Post the record using the same API as ask-AI
|
||||||
await atproto.putRecord(null, record, agent)
|
await agent.api.com.atproto.repo.putRecord({
|
||||||
|
repo: record.repo,
|
||||||
|
collection: record.collection,
|
||||||
|
rkey: record.rkey,
|
||||||
|
record: record.record
|
||||||
|
})
|
||||||
|
|
||||||
// キャッシュを無効化
|
// キャッシュを無効化
|
||||||
collections.invalidateCache(env.collection)
|
collections.invalidateCache(env.collection)
|
||||||
@ -59,6 +64,12 @@ export default function CommentForm({ user, agent, onCommentPosted }) {
|
|||||||
if (onCommentPosted) {
|
if (onCommentPosted) {
|
||||||
onCommentPosted()
|
onCommentPosted()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show success message briefly
|
||||||
|
setText('✓ コメントが投稿されました')
|
||||||
|
setTimeout(() => {
|
||||||
|
setText('')
|
||||||
|
}, 2000)
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err.message)
|
setError(err.message)
|
||||||
@ -112,7 +123,7 @@ export default function CommentForm({ user, agent, onCommentPosted }) {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={loading || !text.trim()}
|
disabled={loading || !text.trim()}
|
||||||
className="btn btn-primary"
|
className={`btn ${loading ? 'btn-outline' : 'btn-primary'}`}
|
||||||
>
|
>
|
||||||
{loading ? '投稿中...' : 'コメントを投稿'}
|
{loading ? '投稿中...' : 'コメントを投稿'}
|
||||||
</button>
|
</button>
|
||||||
|
Reference in New Issue
Block a user