Skip to content

Commit

Permalink
Merge pull request #19 from formio/fix-base-url
Browse files Browse the repository at this point in the history
Fixing issues with base url throwing an error on window.location search.
  • Loading branch information
travist authored Aug 15, 2023
2 parents eaec267 + fe29b25 commit dc35e3b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sdk/Formio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ export class Formio {
this.base = Formio.baseUrl;
}
else if (window && window.location) {
this.base = window.location.href.match(/http[s]?:\/\/api./)![0];
const match = window.location.href.match(/http[s]?:\/\/api./);
this.base = match ? match[0] : window.location.origin;
}

if (!path) {
Expand Down

0 comments on commit dc35e3b

Please sign in to comment.