@equinor/mad-core
Version:
Core library for the Mobile App Delivery team
43 lines (40 loc) • 1.55 kB
JavaScript
import {
getMadCommonBaseUrl,
getMadCommonScopes
} from "./chunk-LNJQIWAH.js";
import {
__async
} from "./chunk-CWMXXUWU.js";
// src/components/screens/release-notes/fetchReleaseNotes.ts
import { ExpoAuthSession } from "@equinor/mad-auth";
var fetchReleaseNotes = (env, servicePortalName, appVersion) => __async(null, null, function* () {
const scopes = getMadCommonScopes(env);
const baseUrl = getMadCommonBaseUrl(env);
const authenticationResponse = yield ExpoAuthSession.authenticateSilently(scopes);
if (!authenticationResponse) throw new Error("Unable to authenticate silently");
const fetchResponse = yield fetch(`${baseUrl}/ReleaseNote/${servicePortalName}/${appVersion}`, {
method: "GET",
headers: new Headers({
Authorization: `Bearer ${authenticationResponse.accessToken}`
})
});
return yield fetchResponse.json();
});
var fetchAllReleaseNotes = (env, servicePortalName) => __async(null, null, function* () {
const scopes = getMadCommonScopes(env);
const baseUrl = getMadCommonBaseUrl(env);
const authenticationResponse = yield ExpoAuthSession.authenticateSilently(scopes);
if (!authenticationResponse) throw new Error("Unable to authenticate silently");
const fetchResponse = yield fetch(`${baseUrl}/ReleaseNote/${servicePortalName}/`, {
method: "GET",
headers: new Headers({
Authorization: `Bearer ${authenticationResponse.accessToken}`
})
});
const result = yield fetchResponse.json();
return result;
});
export {
fetchReleaseNotes,
fetchAllReleaseNotes
};