Skip to content

Commit

Permalink
added url helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
rezk2ll committed Jan 22, 2024
1 parent d26e754 commit ee4d02a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,11 @@ export const getOath2RedirectUri = (challenge: string, redirectUri: string, clie
export const gotoOath2RedirectUrl = (url: string, challenge: string, clientId: string): void => {
goto(getOath2RedirectUri(challenge, url, clientId));
};

/**
* removes trailing slash from a url
*
* @returns {string} the url without a trailing slash
*/
export const removeTrailingSlash = (url: string): string =>
url.endsWith('/') ? url.slice(0, -1) : url;

0 comments on commit ee4d02a

Please sign in to comment.