API 文档中的对象语法无效



我正在关注ConnectyCube API文档,它告诉我在使用Firebase凭据时格式化这样的对象:

const userCredentials = {
provider: 'firebase_phone',
firebase_phone[project_id]: projectId,
firebase_phone[access_token]: idToken,
};

当然,该应用程序不会编译,因为您不能使用这样的方括号,它会抛出 linting 错误。

我试图摆脱它,但它不起作用,他们想告诉我做什么?

固定 - 必须这样写:

provider: 'firebase_phone',
'firebase_phone[project_id]': "xxxxxxxxxx",
'firebase_phone[access_token]': idToken,

最新更新