【发布时间】:2019-08-19 20:07:43
【问题描述】:
我在 React .Net 应用程序中有以下代码:
handleAdd(userId, name) {
name = encodeURIComponent(name);
fetch('api/deck/create/' + userId + '/' + name, {
method: 'POST'
}).then();
}
代码在这里调用:
<Form onSubmit={(id, name) => this.handleAdd(1, this.state.newDeckName)}> //1 is just a debug id
<Modal.Body>
<FormGroup controlId="formNewDeck">
<FormControl placeholder="Deck Name" value={this.state.newDeckName} onChange={this.handleDeckNameChange} name="name"/>
</FormGroup>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={this.handleCloseModal}>Close</Button>
<Button variant="primary" type="submit">Add Deck</Button>
</Modal.Footer>
</Form>
如果我在调试工具中对其进行断点并跳过它,它会命中我的控制器并正确插入到我的数据库中,但是,如果我不在代码上设置断点并让它运行,那么控制器永远不会被命中并且因此没有任何东西插入数据库中,有人对此有解释吗?
【问题讨论】:
-
weel,这些信息是不可能知道的,当你调用这个函数时我们需要更多的代码来检查
-
@MateusMartins 现在包含此信息。
标签: javascript .net reactjs