mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-19 08:02:55 +00:00
refactor: use current location for auth unless production
This commit is contained in:
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openstapps/app",
|
||||
"version": "0.0.1",
|
||||
"version": "2.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -116,8 +116,21 @@ function getEndpointsConfig(
|
||||
* Return a URL of the app, depending on the platform where it is running
|
||||
*/
|
||||
function getRedirectUrl(routePath: string): string {
|
||||
const appSchema = Capacitor.isNativePlatform()
|
||||
? environment.custom_url_scheme
|
||||
: 'https';
|
||||
return `${appSchema}://${environment.app_host}/${routePath}`;
|
||||
let appHost: string;
|
||||
let appSchema: string;
|
||||
if (environment.production) {
|
||||
appSchema = Capacitor.isNativePlatform()
|
||||
? environment.custom_url_scheme
|
||||
: 'https';
|
||||
appHost = environment.app_host;
|
||||
} else {
|
||||
appSchema = Capacitor.isNativePlatform()
|
||||
? environment.custom_url_scheme
|
||||
: window.location.protocol.split(':')[0];
|
||||
|
||||
appHost = Capacitor.isNativePlatform()
|
||||
? environment.app_host
|
||||
: window.location.host;
|
||||
}
|
||||
return `${appSchema}://${appHost}/${routePath}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user