Web: Fix login redirect on Editor not authorized link opening

This commit is contained in:
Alexey Safronov 2021-04-30 18:01:16 +03:00
parent e61375c348
commit 7c1283c26f
4 changed files with 19 additions and 15 deletions

View File

@ -12,7 +12,6 @@ import {
getObjectByLocation,
//showLoader,
//hideLoader,
tryRedirectTo,
} from "@appserver/common/utils";
import {
getDocServiceUrl,
@ -96,7 +95,13 @@ const Editor = () => {
const success = await checkIsAuthenticated();
if (!doc && !success) {
return tryRedirectTo(combineUrl(AppServerConfig.proxyURL, "/login"));
window.open(
combineUrl(AppServerConfig.proxyURL, "/login"),
"_self",
"",
true
);
return;
}
if (success) {

View File

@ -7,6 +7,7 @@ const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const { proxyURL } = AppServerConfig;
const path = require("path");
const pkg = require("./package.json");
@ -134,12 +135,9 @@ const config = {
name: "editor",
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
AppServerConfig.proxyURL,
"/remoteEntry.js"
)}`,
studio: `studio@${combineUrl(proxyURL, "/remoteEntry.js")}`,
files: `files@${combineUrl(
AppServerConfig.proxyURL,
proxyURL,
"/products/files/remoteEntry.js"
)}`,
},

View File

@ -11,14 +11,14 @@
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link id="favicon" rel="shortcut icon" href="<%= proxyURL %>/favicon.ico" />
<link id="favicon" rel="shortcut icon" href="favicon.ico" />
<link rel="manifest" href="<%= proxyURL %>/manifest.json" />
<link rel="manifest" href="manifest.json" />
<!-- Tell the browser it's a PWA -->
<meta name="mobile-web-app-capable" content="yes" />
<!-- Tell iOS it's a PWA -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="apple-touch-icon" href="<%= proxyURL %>/appIcon.png" />
<link rel="apple-touch-icon" href="appIcon.png" />
<link
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i"
rel="stylesheet"

View File

@ -16,8 +16,9 @@ const homepage = pkg.homepage; // combineUrl(proxyURL, pkg.homepage);
const title = pkg.title;
var config = {
mode: "development",
entry: "./src/index",
target: "web",
mode: "development",
devServer: {
publicPath: homepage,
@ -151,9 +152,9 @@ var config = {
template: "./public/index.html",
publicPath: homepage,
title: title,
templateParameters: {
proxyURL: proxyURL,
},
// templateParameters: {
// proxyURL: proxyURL,
// },
base: `${homepage}/`,
}),
new CopyPlugin({
@ -163,7 +164,7 @@ var config = {
globOptions: {
dot: true,
gitignore: true,
ignore: ["**/index.ejs"],
ignore: ["**/index.html"],
},
},
],