在AWS Amplify CLI身份验证配置期间,您可以使用左箭头 ← 或 Ctrl+C 返回到先前的步骤。
如果您在CLI许多选项中迷路了,您可以停止并重新启动身份验证配置。以下是一个具有可重复使用功能的Node.js代码示例:
const configureAuth = async () => {
const previousSteps = [];
// Auth configuration prompts step 1
const step1 = await auth.configure();
// Return to previous step
previousSteps.push(step1);
// Auth configuration prompts step 2
const step2 = await auth.configure();
// Return to previous step
previousSteps.pop();
// Auth configuration prompts step 1
await auth.configure(previousSteps.pop());
}
configureAuth();
在上面的示例中,previousSteps数组记录了已经完成的步骤,并且可以使用pop()方法返回到先前的步骤。