mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-01-10 12:24:20 +01:00
more wip
This commit is contained in:
parent
06d7d65dd1
commit
f72f3b079e
@ -271,7 +271,7 @@ BoardsAPI.prototype.getProfile = function (userID, done) {
|
|||||||
return this.ee
|
return this.ee
|
||||||
}
|
}
|
||||||
|
|
||||||
BoardsAPI.prototype.getBoardSettings = function (userID, board) {
|
BoardsAPI.prototype.getBoardSettings = function (userID, board, done) {
|
||||||
if (!userID) {
|
if (!userID) {
|
||||||
return console.log('Invalid USERID', userID)
|
return console.log('Invalid USERID', userID)
|
||||||
}
|
}
|
||||||
@ -288,9 +288,11 @@ BoardsAPI.prototype.getBoardSettings = function (userID, board) {
|
|||||||
var settings = JSON.parse(resp.toString())
|
var settings = JSON.parse(resp.toString())
|
||||||
if (err) {
|
if (err) {
|
||||||
this.ee.emit('error', err)
|
this.ee.emit('error', err)
|
||||||
|
if (done && done.apply) done(err)
|
||||||
} else {
|
} else {
|
||||||
// SETTINGS file is here, need to parse it a little bit
|
// SETTINGS file is here, need to parse it a little bit
|
||||||
this.ee.emit('settings for ' + board + '@' + userID, settings, r)
|
this.ee.emit('settings for ' + board + '@' + userID, settings, r)
|
||||||
|
if (done && done.apply) done(null, settings)
|
||||||
if (settings.whitelist === true) {
|
if (settings.whitelist === true) {
|
||||||
// Get the whitelist
|
// Get the whitelist
|
||||||
var url = r + this.baseurl + 'boards/' + board + '/whitelist'
|
var url = r + this.baseurl + 'boards/' + board + '/whitelist'
|
||||||
|
@ -28,7 +28,19 @@ module.exports = function (boardsAPI) {
|
|||||||
},
|
},
|
||||||
getBoardSettings (boards) {
|
getBoardSettings (boards) {
|
||||||
if (!this.props.params.board) return
|
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) {
|
handleChange (event) {
|
||||||
var obj = {}
|
var obj = {}
|
||||||
@ -51,6 +63,7 @@ module.exports = function (boardsAPI) {
|
|||||||
}
|
}
|
||||||
this.setState({ updating: true })
|
this.setState({ updating: true })
|
||||||
boards.createBoard(board, (err) => {
|
boards.createBoard(board, (err) => {
|
||||||
|
this.setState({ updating: false })
|
||||||
console.log('CREATE:', err)
|
console.log('CREATE:', err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user