refactor: Removes embedded/index.tsx warnings (#20193)

This commit is contained in:
Michael S. Molina 2022-05-25 17:42:54 -03:00 committed by GitHub
parent 259e03ee12
commit 73443cea2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -19,7 +19,7 @@
import React, { lazy, Suspense } from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import { makeApi, t } from '@superset-ui/core';
import { makeApi, t, logging } from '@superset-ui/core';
import { Switchboard } from '@superset-ui/switchboard';
import { bootstrapData } from 'src/preamble';
import setupClient from 'src/setup/setupClient';
@ -35,7 +35,7 @@ const debugMode = process.env.WEBPACK_MODE === 'development';
function log(...info: unknown[]) {
if (debugMode) {
console.debug(`[superset]`, ...info);
logging.debug(`[superset]`, ...info);
}
}
@ -69,16 +69,16 @@ const appMountPoint = document.getElementById('app')!;
const MESSAGE_TYPE = '__embedded_comms__';
function showFailureMessage(message: string) {
appMountPoint.innerHTML = message;
}
if (!window.parent || window.parent === window) {
showFailureMessage(
'This page is intended to be embedded in an iframe, but it looks like that is not the case.',
);
}
function showFailureMessage(message: string) {
appMountPoint.innerHTML = message;
}
// if the page is embedded in an origin that hasn't
// been authorized by the curator, we forbid access entirely.
// todo: check the referrer on the route serving this page instead
@ -134,7 +134,7 @@ function start() {
},
err => {
// something is most likely wrong with the guest token
console.error(err);
logging.error(err);
showFailureMessage(
'Something went wrong with embedded authentication. Check the dev console for details.',
);