我尝试发布突变查询抛出我的nodejs
基础grapql
api。
我在服务器端的架构:
...
input PostPickProps {
userId: String
matchId: String
predictionModelId: String
modelVersionNumber: Int
modelVariationIndex: Int
pickEnd: String
}
type Mutation {
postPick(props: PostPickProps): String
}
...
Run Code Online (Sandbox Code Playgroud)
从应用程序查询:
export const postPick = async ({
userId,
matchId,
predictionModelId,
modelVersionNumber,
modelVariationIndex,
pickEnd
}) => {
const res = await fetch(`
mutation {
postPick(props: {
userId: "${userId}"
matchId: "${matchId}"
predictionModelId: "${predictionModelId}"
modelVersionNumber: ${modelVersionNumber}
modelVariationIndex: ${modelVariationIndex}
pickEnd: "${pickEnd}"
})
}
`)
return res
}
Run Code Online (Sandbox Code Playgroud)
我在服务器端的解析器:
export const postPick = async …
Run Code Online (Sandbox Code Playgroud) 我尝试通过https://reactjs.org/docs/error-boundaries.html实现错误边界,但它只捕获渲染错误。
react
是否可以在异步进程和处理程序上实现全局 try/catch 和捕获错误之类的东西?
就像是:
try {
ReactDOM.render(<App />, document.getElementById("root"));
} catch (error) {
console.log("CAUGHT AN ERROR!!!!!!!")
console.log(error);
ReactDOM.render(<ErrorComponent />, document.getElementById("root"));
}
Run Code Online (Sandbox Code Playgroud) 我想url query
在位置上存储为状态。
~ history.push({
+ ...history.location,
+ search: query.toString(),
+ state: {
+ myState: query.toString(),
+ },
+ })
Run Code Online (Sandbox Code Playgroud)
我怀疑在路线改变时获得状态,但当我从其他路线回来时state
变成undefined
状态。
我尝试从根目录运行脚本但收到错误:
ERR! lerna Unknown argument: d
来自 root package.json 的命令:
"start:scripts:api-football:start:collectDayMatches:dev": "lerna run start:collectDayMatches:dev --stream"
尝试运行yarn start:scripts:api-football:start:collectDayMatches:dev -- -d 2002-02-02
我有centos7
php56
laravel 5
,memcached
但是当我尝试时use Cache
,routes.php
我得到:
ErrorException in routes.php line 3:
The use statement with non-compound name 'Cache' has no effect
Run Code Online (Sandbox Code Playgroud)
router.php
<?php
use Cache;
...
Run Code Online (Sandbox Code Playgroud) 我"cypress": "2.1.0"
用于网站功能测试。
我在测试中也有条件:
if (WIDTH < 1025 && WIDTH > 480) {
it('Open search sidebar', function () {
cy.wait(500);
cy.get('.FilterStroke_resultsLabel_7gBlM').safeClick();
});
}
Run Code Online (Sandbox Code Playgroud)
我的问题是如何获得屏幕尺寸(WIDTH, HEIGHT)
?
let foo = {};
const key1 = 'a';
const key2 = 'b';
const key3 = 'c';
foo[key1][key2][key3] = [1, 2];
Run Code Online (Sandbox Code Playgroud)
当我尝试做类似的事情时,我得到:
Uncaught TypeError: Cannot read property 'b' of undefined
Run Code Online (Sandbox Code Playgroud) 我有 myDocument 架构:
{
name: {type: String},
data: [{type: Schema.Types.ObjectId, ref: 'myData'}],
}
Run Code Online (Sandbox Code Playgroud)
我的目标是只填充数据数组中的第一个元素。
myDocument.find({}).populate('data').exec();
Run Code Online (Sandbox Code Playgroud)
我只想从 myData 数组 (myDocument.data[0]) 中选择第一个元素。
如果数组是 emty ,则 myDocument.data.length === 1 或 0。
javascript ×3
reactjs ×2
caching ×1
cypress ×1
eclipse ×1
graphql ×1
laravel ×1
lerna ×1
mongodb ×1
mongoose ×1
node.js ×1
php ×1
react-router ×1
typescript ×1
yarnpkg ×1