From 7e349c17682863ff8bb50df168dda05f77b8dfec Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sun, 27 Aug 2023 21:58:58 +0800 Subject: [PATCH] feat: fix crash bug in getSteps() --- web/src/TourConfig.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/TourConfig.js b/web/src/TourConfig.js index 0bb824ab..c9171677 100644 --- a/web/src/TourConfig.js +++ b/web/src/TourConfig.js @@ -218,6 +218,12 @@ export function getNextButtonChild(nextPathName) { : "Finish"; } -export function getSteps(pathName = window.location.pathname) { - return TourObj[(pathName.replace("/", ""))]; +export function getSteps() { + const path = window.location.pathname.replace("/", ""); + const res = TourObj[path]; + if (res === undefined) { + return []; + } else { + return res; + } }