Skip to content

Commit

Permalink
refactor: used regex to remove suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi-bams committed Apr 15, 2024
1 parent 98b01f5 commit 7b2815c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/utils/apiUrlFromSwarmHost/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export function apiUrlFromSwarmHost(): string | undefined {
}

export function removeApi(url: string) {
if (url.endsWith('/api')) {
return url.substring(0, url.length - 4)
}
const regex = /\/api$/

return url
return url.replace(regex, '')
}

0 comments on commit 7b2815c

Please sign in to comment.