Files
ota-admin-portal/src/services/superset.js
John Wu b80a2cb8bf Release/0.0.3 to main (#254)
* CEC-2628 - Display IP in digital twin in portal (#251)

* CEC-3453 Update security dll instructions (#252)

* CEC-2752-Add-Mobile-Issue-Tracker (#250)

* first commit

* removed comments

* remove more comments

* fix build issues

* fix unused vars

* update snapshot

* fix test

* Fix connect ECONNREFUSED 127.0.0.1:80

* Test Magna side menu

* attempt to pass test

* fix test

* remove comments

* fix some code smells

* fix test

* resolve comments

* fix bug

* resolved comments

* resolve comments

* resolve comments

* update snapshot

* resolved comments

Co-authored-by: jwu-fisker <jwu@fiskerinc.com>

* Cec 2752 small fix (#253)

* first commit

* removed comments

* remove more comments

* fix build issues

* fix unused vars

* update snapshot

* fix test

* Fix connect ECONNREFUSED 127.0.0.1:80

* Test Magna side menu

* attempt to pass test

* fix test

* remove comments

* fix some code smells

* fix test

* resolve comments

* fix bug

* resolved comments

* resolve comments

* resolve comments

* update snapshot

* resolved comments

* small fix

Co-authored-by: jwu-fisker <jwu@fiskerinc.com>

Co-authored-by: Paul Adamsen <117673433+pauladamseniii@users.noreply.github.com>
Co-authored-by: das31 <31259710+das31@users.noreply.github.com>
2023-01-10 18:30:39 -08:00

51 lines
1.4 KiB
JavaScript

import {
addQueryParams, getAuthHeaderOptions
} from "../utils/http";
//Added the token we got from the first authorization and set it as the auth token, and that allowed us to hit the request
const API_ENDPOINT = process.env.REACT_APP_OTA_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
},
getEmbeddedDashboards: async(token) => {
const u = addQueryParams(`${API_ENDPOINT}/dashboard/embedded-dashboards`);
let res = await fetch(u, {
method: "GET",
headers: Object.assign(
getAuthHeaderOptions(token)
),
})
if(res.status !== 200){
return [{title: "dashboard", embedded_id: GetSupersetDashboardID()}]
}
let r = await res.json()
return r
},
SupersetDashboardURL: () => {
const SUPERSET_BASE_URL = process.env.REACT_APP_SUPERSET_URL;
return SUPERSET_BASE_URL
},
SupersetDashboardID: () => {
return GetSupersetDashboardID()
}
}
const GetSupersetDashboardID = () => {
const SUPERSET_BASE_ID = process.env.REACT_APP_SUPERSET_KEYS_LIST;
return SUPERSET_BASE_ID
}
export default supersetAPI;