parent
411c2c24c3
commit
57031fed10
|
|
@ -36,13 +36,15 @@ import { connect } from "react-redux";
|
|||
|
||||
import * as Sentry from "@sentry/react";
|
||||
import AnalyticsUtil from "utils/AnalyticsUtil";
|
||||
import { trimTrailingSlash } from "utils/helpers";
|
||||
|
||||
const SentryRoute = Sentry.withSentryRouting(Route);
|
||||
|
||||
const loadingIndicator = <PageLoadingBar />;
|
||||
|
||||
function changeAppBackground(currentTheme: any) {
|
||||
if (
|
||||
window.location.pathname === "/applications" ||
|
||||
trimTrailingSlash(window.location.pathname) === "/applications" ||
|
||||
window.location.pathname.indexOf("/settings/") !== -1
|
||||
) {
|
||||
document.body.style.backgroundColor =
|
||||
|
|
|
|||
|
|
@ -117,3 +117,22 @@ export const isMac = () => {
|
|||
typeof navigator !== "undefined" ? navigator.platform : undefined;
|
||||
return !platform ? false : /Mac|iPod|iPhone|iPad/.test(platform);
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the trailing slashes from the path
|
||||
* @param path
|
||||
* @example
|
||||
* ```js
|
||||
* let trimmedUrl = trimTrailingSlash('/url/')
|
||||
* console.log(trimmedUrl) //will output /url
|
||||
* ```
|
||||
* @example
|
||||
* ```js
|
||||
* let trimmedUrl = trimTrailingSlash('/yet-another-url//')
|
||||
* console.log(trimmedUrl) // will output /yet-another-url
|
||||
* ```
|
||||
*/
|
||||
export const trimTrailingSlash = (path: string) => {
|
||||
const trailingUrlRegex = /\/+$/;
|
||||
return path.replace(trailingUrlRegex, "");
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user