Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
215 views
in Technique[技术] by (71.8m points)

javascript - 使用Reac Redux更新现有数据(Updating existing data with Reac Redux)

I have a problem with POST method in my React Redux project.

(我的React Redux项目中的POST方法有问题。)

As there is a lat of code here is a link to repo.

(由于有少量代码, 这里是回购的链接。)

All is happening in my Waiter.js WaiterContainer.js tablesRedux.js and store.

(一切都在我的Waiter.js WaiterContainer.js tablesRedux.js和存储中进行。)

Those files are in src folder.

(这些文件在src文件夹中。)

Data that i want to update i have in public/db/app.json http://localhost:3131/tables

(我要更新的数据包含在public/db/app.json http:// localhost:3131 / tables中)

I am displaying Waiter tab where i have: Table, Status, Order and Action From Waiter i want to update table status simply by clicking on Status.

(我正在显示“服务员”选项卡,其中有:表,状态,订单和操作从“服务员”中,我只想单击状态即可更新表状态。)

Goal is to display new status in Waiter tab and in my db.

(目标是在“服务员”选项卡和我的数据库中显示新状态。)

Right now in my Waiter.js file i have onClick method where i have hardcoded the status.

(现在在我的Waiter.js文件中,我有onClick方法,在其中我已对状态进行了硬编码。)

Now my problem is that POST method is working, partialy.

(现在我的问题是POST方法正在工作,部分地。)

I am pushing something like this

(我在推这样的东西)

 "tables": {
      "id": 4,
      "status": "thinking",
      "order": 3647
    },
    "id": 12
  },

So i'm not searching my tables for matching id, but just adding a new one with details of existing data.

(因此,我不会在表中搜索匹配的ID,而只是添加一个包含现有数据详细信息的新ID。)

I have no clue where the bug is :/ And right now i am hitting my head.

(我不知道错误在哪里:/现在我正在打我的头。)

Thanks for any help!

(谢谢你的帮助!)

  ask by shivetay translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...