mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore: type a couple easy to type files (#11838)
This commit is contained in:
@@ -20,14 +20,16 @@ import { SupersetClient, logging } from '@superset-ui/core';
|
||||
import parseCookie from 'src/utils/parseCookie';
|
||||
|
||||
export default function setupClient() {
|
||||
const csrfNode = document.querySelector('#csrf_token');
|
||||
const csrfToken = csrfNode ? csrfNode.value : null;
|
||||
const csrfNode = document.querySelector<HTMLInputElement>('#csrf_token');
|
||||
const csrfToken = csrfNode?.value;
|
||||
|
||||
// when using flask-jwt-extended csrf is set in cookies
|
||||
const cookieCSRFToken = parseCookie().csrf_access_token || '';
|
||||
|
||||
SupersetClient.configure({
|
||||
protocol: (window.location && window.location.protocol) || '',
|
||||
protocol: ['http:', 'https:'].includes(window?.location?.protocol)
|
||||
? (window?.location?.protocol as 'http:' | 'https:')
|
||||
: undefined,
|
||||
host: (window.location && window.location.host) || '',
|
||||
csrfToken: csrfToken || cookieCSRFToken,
|
||||
})
|
||||
Reference in New Issue
Block a user