aboutsummaryrefslogtreecommitdiff
path: root/src/ReplyForm.js
diff options
context:
space:
mode:
authorLibravatar Renard 2019-09-25 23:33:29 -0300
committerLibravatar Renard 2019-09-25 23:33:29 -0300
commit56f23fad45bab476efe6a74f207dfe78470f1b87 (patch)
tree8527e90576bdd863e0ba48df460ca03f2cbc86c6 /src/ReplyForm.js
parent52f3fa7fea2915d9db7d9e97f926ad544ac328c4 (diff)
downloadbai-client-56f23fad45bab476efe6a74f207dfe78470f1b87.tar.gz
bai-client-56f23fad45bab476efe6a74f207dfe78470f1b87.tar.xz
bai-client-56f23fad45bab476efe6a74f207dfe78470f1b87.zip
Registro de posts propios 🔥
Diffstat (limited to 'src/ReplyForm.js')
-rw-r--r--src/ReplyForm.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/ReplyForm.js b/src/ReplyForm.js
index 48be8e8..0b01029 100644
--- a/src/ReplyForm.js
+++ b/src/ReplyForm.js
@@ -40,13 +40,15 @@ class ReplyForm extends Component {
{
submittedName: name,
submittedEmail: email,
- submittedMessage: message
+ submittedMessage: message,
+ replyRes: null
},
() => {
const { submittedName, submittedEmail, submittedMessage } = this.state;
+ const { currentBoard, parent } = this.props;
const data = {
- board: this.props.currentBoard.dir,
- parent: this.props.parent,
+ board: currentBoard.dir,
+ parent: parent,
name: "",
email: "",
fielda: submittedName,
@@ -75,6 +77,19 @@ class ReplyForm extends Component {
.then(resource => {
if (resource.state === "success") {
this.setState({ replyRes: resource, message: "" });
+ let ownPosts = JSON.parse(localStorage.getItem("ownPosts"));
+ if (ownPosts === null) {
+ ownPosts = {};
+ }
+ // eslint-disable-next-line no-prototype-builtins
+ if (!ownPosts.hasOwnProperty(currentBoard.dir)) {
+ ownPosts[currentBoard.dir] = [];
+ }
+ ownPosts[currentBoard.dir] = ownPosts[currentBoard.dir].concat({
+ thread_id: parent,
+ reply_id: resource.post_id
+ });
+ localStorage.setItem("ownPosts", JSON.stringify(ownPosts));
}
});
}