Skip to content

Commit f3ead51

Browse files
authored
Merge pull request #25 from uniquelyparticular/development
release: fix: added removeTrailingSlash to store_url
2 parents 5a03020 + 9610f70 commit f3ead51

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fetch from 'cross-fetch';
22

33
import { InitOptions, Options, Headers, Fetch } from './types';
4-
import { removeLeadingSlash } from './utils';
4+
import { removeLeadingSlash, removeTrailingSlash } from './utils';
55

66
export class createClient {
77
private access_token: string;
@@ -14,7 +14,7 @@ export class createClient {
1414
this.fetch = options.fetch ? options.fetch : fetch;
1515

1616
this.options = {
17-
store_url,
17+
store_url: removeTrailingSlash(store_url),
1818
store_code,
1919
...others
2020
};

src/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
export function removeLeadingSlash(string: string) {
22
return string.replace(/^\/+/, '');
33
}
4+
5+
export function removeTrailingSlash(string: string) {
6+
return string.replace(/\/$/, '');
7+
}

0 commit comments

Comments
 (0)