CEC-2269: Embdeded Superset (#228)

Co-authored-by: Alexander Andrews <aandrews@fiskerinc.com>
This commit is contained in:
Alexander Andrews
2022-10-28 12:51:12 -04:00
committed by GitHub
parent 9a9766df12
commit c5a86a5e61
11 changed files with 201 additions and 17 deletions

View File

@@ -1,5 +1,35 @@
const SUPERSET_BASE_URL = process.env.REACT_APP_SUPERSET_URL;
import {
getAuthHeaderOptions,
addQueryParams,
} from "../utils/http";
const SupersetDashboardURL = `${SUPERSET_BASE_URL}/r/3`;
//Added the token we got from the first authorization and set it as the auth token, and that allowed us to hit the request
export { SupersetDashboardURL };
const API_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL;
const supersetAPI = {
getGuestToken: async(token) => {
const u = addQueryParams(`${API_ENDPOINT}/dashboard/guest-token`);
let res = await fetch(u, {
method: "GET",
headers: Object.assign(
//{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
})
let r = await res.json()
let q = r["token"]
return q
},
SupersetDashboardURL: () => {
const SUPERSET_BASE_URL = process.env.REACT_APP_SUPERSET_URL;
return SUPERSET_BASE_URL
},
SupersetDashboardID: () => {
const SUPERSET_BASE_ID = process.env.REACT_APP_SUPERSET_KEYS_LIST;
return SUPERSET_BASE_ID
}
}
export default supersetAPI;