如何分析 SAP Spartacus 路由问题之 CheckoutAuthGuard 单步调试

简介: 如何分析 SAP Spartacus 路由问题之 CheckoutAuthGuard 单步调试

This document is written based on Spartacus 3.1.1.


The standard Storefront is used which is generated by Spartacus Schematics.


Suppose I would like to debug the executing of CheckoutAuthGuard for standard checkout step:Delivery Mode.



image.pngIt means I need to set some breakpoint in the step BEFORE Delivery Mode, in this case it is Shipping address step, and then click “Continue” button to trigger the breakpoint.


in your project, expand folder node_modules/@spartacus:


image.png

image.pngthen storefront/fesm2015, find file spartacus-storefront.js:image.pngSearch by key word “CheckoutDeliveryMode”, which is the default CMS component for Delivery Mode checkout step.


You see line 11037, the two standard component guard, CheckoutAuthGuard and CartNotEmptyGuard are defined there.


Add some product to carts, then open url:


http://localhost:4200/electronics-spa/en/USD/checkout/shipping-address


open Chrome Development tool,switch to Sources tab,press Ctrl+ O,type spa, then select spartacus-storefront.js from search list:



image.png

image.pngthen search by keyword CheckoutAuthGuard:image.pngand set breakpoint in method canActivate.


Let’s say if a checkout Component has configured Component guards A,B,C, only if all guards return true intheir canActivate method, then the corresponding checkout step page could be opened.


In my case I press “continue” button in Shipping Address page, then breakpoint is triggered.


image.pngthen you can debug to check the guard execution.image.pngAs mentioned by document, canActivate method is expected to return true to achieve the routing of next checkout step.

相关文章
|
5月前
|
人工智能 搜索推荐 Serverless
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
|
5月前
|
Web App开发 数据采集 前端开发
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
|
5月前
|
存储 前端开发
SAP UI5 federatedLogout 函数源代码分析
SAP UI5 federatedLogout 函数源代码分析
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
|
5月前
|
网络安全
实战分析 - 为什么有些 SAP ABAP 程序,启动之后界面有些按钮是灰色的试读版
实战分析 - 为什么有些 SAP ABAP 程序,启动之后界面有些按钮是灰色的试读版
|
5月前
|
安全 开发者
如何在 SAP ERP 系统调试 Product Initial Download
如何在 SAP ERP 系统调试 Product Initial Download
|
5月前
|
中间件
如何在 SAP CRM 系统调试 Product Initial Download
如何在 SAP CRM 系统调试 Product Initial Download
|
5月前
|
开发者
jQuery.Deferred 在 SAP UI5 源代码中的应用分析
jQuery.Deferred 在 SAP UI5 源代码中的应用分析
|
5月前
|
数据库
SAP ABAP 更新函数(Update Function Module)执行出错的原因分析试读版
SAP ABAP 更新函数(Update Function Module)执行出错的原因分析试读版
|
5月前
|
数据库
130. SAP ABAP 更新函数(Update Function Module)执行出错的原因分析
130. SAP ABAP 更新函数(Update Function Module)执行出错的原因分析
下一篇
无影云桌面