fix post commnet

This commit is contained in:
2025-06-19 19:58:40 +09:00
parent 004081337c
commit 3adcfdacf5

View File

@ -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)
@ -60,6 +65,12 @@ export default function CommentForm({ user, agent, onCommentPosted }) {
onCommentPosted() onCommentPosted()
} }
// Show success message briefly
setText('✓ コメントが投稿されました')
setTimeout(() => {
setText('')
}, 2000)
} catch (err) { } catch (err) {
setError(err.message) setError(err.message)
} finally { } finally {
@ -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>