1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-01-10 12:24:20 +01:00
This commit is contained in:
Enrico Fasoli 2015-12-16 19:15:06 +01:00
parent 06d7d65dd1
commit f72f3b079e
2 changed files with 17 additions and 2 deletions

View File

@ -271,7 +271,7 @@ BoardsAPI.prototype.getProfile = function (userID, done) {
return this.ee
}
BoardsAPI.prototype.getBoardSettings = function (userID, board) {
BoardsAPI.prototype.getBoardSettings = function (userID, board, done) {
if (!userID) {
return console.log('Invalid USERID', userID)
}
@ -288,9 +288,11 @@ BoardsAPI.prototype.getBoardSettings = function (userID, board) {
var settings = JSON.parse(resp.toString())
if (err) {
this.ee.emit('error', err)
if (done && done.apply) done(err)
} else {
// SETTINGS file is here, need to parse it a little bit
this.ee.emit('settings for ' + board + '@' + userID, settings, r)
if (done && done.apply) done(null, settings)
if (settings.whitelist === true) {
// Get the whitelist
var url = r + this.baseurl + 'boards/' + board + '/whitelist'

View File

@ -28,7 +28,19 @@ module.exports = function (boardsAPI) {
},
getBoardSettings (boards) {
if (!this.props.params.board) return
boards.getBoardSettings(boards.getMyID(), this.props.params.board)
this.setState({ loading: true })
boards.getBoardSettings(boards.getMyID(), this.props.params.board, (err, s) => {
if (err) {
this.setState({ error: err, loading: false })
} else {
this.setState({
id: this.props.params.board,
name: s.fullname,
desc: s.description,
loading: false
})
}
})
},
handleChange (event) {
var obj = {}
@ -51,6 +63,7 @@ module.exports = function (boardsAPI) {
}
this.setState({ updating: true })
boards.createBoard(board, (err) => {
this.setState({ updating: false })
console.log('CREATE:', err)
})
},