1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-03-29 00:08:39 +01:00
ipfs-boards/src/sagas/posts.js

27 lines
872 B
JavaScript

import { apply, call } from 'redux-saga/effects'
import { ipfsPut } from '../utils/ipfs'
import { goToBoard } from './boards';
export function* addPost({ address, post }) {
const db = window.dbs[address]
const { title, text } = post
yield apply(db, db.addPost, { title, text })
yield goToBoard({ board: { address } });
// TODO: goto post
}
export function* editPost({ address, postId, post }) {
const db = window.dbs[address]
const { title, text } = post
yield apply(db, db.updatePost, [postId, { title, text }])
yield goToBoard({ board: { address } });
// TODO: goto post
}
export function* editPost({ address, postId, post }) {
const db = window.dbs[address]
const { title, text } = post
yield apply(db, db.updatePost, [postId, { title, text }])
yield goToBoard({ board: { address } });
// TODO: goto post
}