diff --git a/lib/utils/url-utils.js b/lib/utils/url-utils.js --- a/lib/utils/url-utils.js +++ b/lib/utils/url-utils.js @@ -3,13 +3,14 @@ import urlParseLax from 'url-parse-lax'; export type URLInfo = { - year?: number, - month?: number, // 1-indexed - verify?: string, - calendar?: boolean, - chat?: boolean, - apps?: boolean, - thread?: string, + +year?: number, + +month?: number, // 1-indexed + +verify?: string, + +calendar?: boolean, + +chat?: boolean, + +apps?: boolean, + +thread?: string, + +settings?: 'account', ... }; @@ -20,6 +21,7 @@ const calendarRegex = new RegExp('(/|^)calendar(/|$)', 'i'); const chatRegex = new RegExp('(/|^)chat(/|$)', 'i'); const appsRegex = new RegExp('(/|^)apps(/|$)', 'i'); +const accountSettingsRegex = new RegExp('(/|^)settings/account(/|$)', 'i'); function infoFromURL(url: string): URLInfo { const yearMatches = yearRegex.exec(url); @@ -29,6 +31,7 @@ const calendarTest = calendarRegex.test(url); const chatTest = chatRegex.test(url); const appsTest = appsRegex.test(url); + const accountSettingsTest = accountSettingsRegex.test(url); const returnObj = {}; if (yearMatches) { returnObj.year = parseInt(yearMatches[2], 10); @@ -52,6 +55,8 @@ returnObj.chat = true; } else if (appsTest) { returnObj.apps = true; + } else if (accountSettingsTest) { + returnObj.settings = 'account'; } return returnObj; }