mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-01-09 12:19:49 +01:00
bug fixes
This commit is contained in:
parent
e9903eac00
commit
0c6d9a3a88
@ -60,7 +60,7 @@ export default class PostForm extends Component {
|
||||
<Button as={Link} to={shortenAddress(address)}>
|
||||
<Icon name="chevron left"/> Board
|
||||
</Button>
|
||||
<Button type='submit' onClick={() => onSave({ title, content })}>
|
||||
<Button type='submit' onClick={() => onSave({ title, text: content })}>
|
||||
<Icon name="save"/> Submit
|
||||
</Button>
|
||||
</Form>
|
||||
|
@ -18,19 +18,10 @@ export async function start() {
|
||||
repo: 'ipfs-v6-boards-v0',
|
||||
EXPERIMENTAL: {
|
||||
pubsub: true
|
||||
},
|
||||
config: {
|
||||
Addresses: {
|
||||
Swarm: [
|
||||
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
|
||||
'/dns4/ws-star-signal-1.servep2p.com/tcp/443/wss/p2p-websocket-star',
|
||||
'/dns4/ws-star-signal-2.servep2p.com/tcp/443/wss/p2p-websocket-star'
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
await new Promise(fullfill => {
|
||||
window.ipfs.on('ready', () => fullfill())
|
||||
await new Promise(resolve => {
|
||||
window.ipfs.on('ready', () => resolve())
|
||||
})
|
||||
}
|
||||
if (!window.orbitDb) {
|
||||
@ -40,6 +31,7 @@ export async function start() {
|
||||
}
|
||||
|
||||
export async function open(address, metadata) {
|
||||
if (window.dbs && window.dbs[address]) return window.dbs[address]
|
||||
await start()
|
||||
const options = {
|
||||
type: BoardStore.type,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { put, call, fork, take, apply } from 'redux-saga/effects'
|
||||
import { put, call, fork, take } from 'redux-saga/effects'
|
||||
import { eventChannel } from 'redux-saga'
|
||||
import { push } from 'react-router-redux'
|
||||
import { open, connectDb } from '../orbitdb'
|
||||
@ -31,7 +31,7 @@ export function* closeBoard({ address }){
|
||||
export function* updateBoardMetadata({ address, metadata }){
|
||||
const db = window.dbs[address]
|
||||
if (db) {
|
||||
yield apply(db, db.updateMetadata, [metadata])
|
||||
yield call([db, db.updateMetadata], [metadata])
|
||||
yield goToBoard({ board: { address } });
|
||||
} else {
|
||||
yield put({ type: 'ERROR', error: address + ' not found' })
|
||||
|
@ -9,7 +9,6 @@ import {
|
||||
UPDATE_BOARD_METADATA
|
||||
} from '../actions/actionTypes'
|
||||
import { openBoard, updateBoard, goToBoard, updateBoardMetadata, closeBoard } from './boards'
|
||||
import { openBoard as openBoardAction } from '../actions/board'
|
||||
import { addPost } from './posts'
|
||||
import { openPreviousBoards, saveSaga } from './persistence'
|
||||
|
||||
|
@ -1,19 +1,18 @@
|
||||
import { apply, call } from 'redux-saga/effects'
|
||||
import { ipfsPut } from '../utils/ipfs'
|
||||
import { call } from 'redux-saga/effects'
|
||||
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 } });
|
||||
yield call([db, db.addPost], { title, text })
|
||||
yield goToBoard({ board: { address, redirect: true } });
|
||||
// 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 } });
|
||||
yield call([db, db.updatePost], postId, { title, text })
|
||||
yield goToBoard({ board: { address, redirect: true } });
|
||||
// TODO: goto post
|
||||
}
|
Loading…
Reference in New Issue
Block a user