如何分析 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.
It 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:
then storefront/fesm2015, find file spartacus-storefront.js:
Search 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:
open Chrome Development tool,switch to Sources tab,press Ctrl+ O,type spa, then select spartacus-storefront.js from search list:
then search by keyword CheckoutAuthGuard:
and 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.
then you can debug to check the guard execution.
As mentioned by document, canActivate method is expected to return true to achieve the routing of next checkout step.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2776909/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SAP 電商雲 Spartacus 伺服器端渲染的單步除錯詳細步驟伺服器除錯
- SAP 電商雲 Spartacus UI Angular Component 動態建立的單步除錯UIAngular除錯
- SAP Spartacus 伺服器端渲染單步除錯步驟之一:應用程式準備工作伺服器除錯
- python如何單步除錯Python除錯
- SAP UI5 框架是如何執行 batch 請求的單步除錯UI框架BAT除錯
- SAP UI5 sap.ui.Device.media.initRangeSet 方法的單步除錯UIdev除錯
- SAP Spartacus 伺服器端渲染單步除錯步驟之二:在伺服器端執行應用程式 Angular 程式碼伺服器除錯Angular
- SAP UI5 ODataModel.createEntry 單步除錯UI除錯
- SAP UI5 BaseObject.extend 方法的單步除錯UIObject除錯
- 關於 SAP 電商雲 Spartacus UI 路由 routes 配置的資料來源問題UI路由
- 關於 SAP Spartacus 和 SmartEdit 整合的問題
- SAP Spartacus 預設路由配置的工作原理路由
- SAP Spartacus internationalization ( i18n ) 翻譯問題的排錯指南
- rxjs Observable of 操作符的單步除錯分析JS除錯
- Swoole 如何使用 Xdebug 進行單步除錯除錯
- 使用 Tag Assistant 除錯 SAP 電商雲 Spartacus UI 的 TMS 模組除錯UI
- Angular 內容投影 content projection 的一個問題的單步除錯AngularProject除錯
- 關於 Angular view Query 的 id 選擇器問題的單步除錯AngularView除錯
- SAP 電商雲 CMSUserGroupRestriction 在 Spartacus 裡的 evaluation 問題REST
- NgRx Store createSelector 的單步除錯和原始碼分析除錯原始碼
- 關於 SAP Fiori Elements 應用標題屬性(title) 的複製邏輯單步除錯除錯
- 除錯篇——斷點與單步除錯斷點
- codeblocks單步除錯詳解BloC除錯
- linux下gdb單步除錯Linux除錯
- SAP UI5 架設在 http-proxy 庫上的單步除錯UIHTTP除錯
- 除錯cmp問題除錯
- SAP Spartacus SSR 模式下 index.html 頁面的響應邏輯除錯模式IndexHTML除錯
- SAP Spartacus 讀取 Cart 的原理分析
- Angular 內容投影 content projection 關於選擇器問題的單步除錯AngularProject除錯
- Angular 內容投影 content projection 關於條件渲染問題的單步除錯AngularProject除錯
- 關於 SAP 電商雲 Spartacus UI SSR 的 state transfer 問題UI
- SAP 電商雲 Spartacus UI product 明細頁面的路由配置UI路由
- SAP S/4HANA擴充套件欄位建立過程的單步除錯套件除錯
- SAP Fiori Elements List Report 列表寬度決定邏輯的單步除錯除錯
- SAP UI5 Mock Server 在響應 OData 請求時的單步除錯UIMockServer除錯
- Angular 基於自定義指令的內容投影 content projection 問題的單步除錯AngularProject除錯
- SAP 電商雲 Spartacus UI CI 指令碼分析UI指令碼
- go除錯的問題。Go除錯