mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-14 16:49:10 +00:00
chore(web): memoize default url since it'll mostly always be the same no matter what
This commit is contained in:
parent
a87ccd9c54
commit
fac361d277
3 changed files with 23 additions and 13 deletions
|
@ -19,6 +19,7 @@
|
|||
"@types/node": "^14.14.33",
|
||||
"@types/react": "^17.0.3",
|
||||
"@types/react-dom": "^17.0.2",
|
||||
"memoize-one": "^5.1.1",
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1",
|
||||
"react-helmet": "^6.1.0",
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
export const getDefaultApiUrl = (host: string = window.location.hostname) => {
|
||||
if (/^roleypoly.com$/.test(host)) {
|
||||
return 'https://api-prod.roleypoly.com';
|
||||
} else if (
|
||||
/roleypoly\.pages\.dev$/.test(host) ||
|
||||
/^stage.roleypoly.com$/.test(host)
|
||||
) {
|
||||
return 'https://api-stage.roleypoly.com';
|
||||
} else if (/\blocalhost|127\.0\.0\.1\b/.test(host)) {
|
||||
return 'http://localhost:6609';
|
||||
} else {
|
||||
return 'https://api-prod.roleypoly.com';
|
||||
import * as memoizeOne from 'memoize-one';
|
||||
|
||||
export const getDefaultApiUrl = memoizeOne.default(
|
||||
(host: string = window.location.hostname) => {
|
||||
if (/^roleypoly.com$/.test(host)) {
|
||||
return 'https://api-prod.roleypoly.com';
|
||||
} else if (
|
||||
/roleypoly\.pages\.dev$/.test(host) ||
|
||||
/^stage.roleypoly.com$/.test(host)
|
||||
) {
|
||||
return 'https://api-stage.roleypoly.com';
|
||||
} else if (/\blocalhost|127\.0\.0\.1\b/.test(host)) {
|
||||
return 'http://localhost:6609';
|
||||
} else {
|
||||
return 'https://api-prod.roleypoly.com';
|
||||
}
|
||||
}
|
||||
};
|
||||
);
|
||||
|
|
|
@ -10571,6 +10571,11 @@ media-typer@0.3.0:
|
|||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
|
||||
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
|
||||
|
||||
memoize-one@^5.1.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.1.1.tgz#047b6e3199b508eaec03504de71229b8eb1d75c0"
|
||||
integrity sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA==
|
||||
|
||||
memoizerific@^1.11.3:
|
||||
version "1.11.3"
|
||||
resolved "https://registry.yarnpkg.com/memoizerific/-/memoizerific-1.11.3.tgz#7c87a4646444c32d75438570905f2dbd1b1a805a"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue