Fix regression in fetchConfiguration
This commit is contained in:
parent
8b110020e1
commit
8081e7fee9
1 changed files with 1 additions and 4 deletions
|
@ -127,7 +127,6 @@ export class App extends React.Component<IAppProps> {
|
|||
*/
|
||||
export async function fetchConfiguration(): Promise<Configuration> {
|
||||
const url = `${import.meta.env.VITE_API_URL}`;
|
||||
|
||||
// The test library cannot use the Fetch API
|
||||
// @ts-ignore
|
||||
if (window.fetch) {
|
||||
|
@ -138,15 +137,13 @@ export async function fetchConfiguration(): Promise<Configuration> {
|
|||
response.json()
|
||||
) as Configuration;
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', url, true);
|
||||
xhr.onreadystatechange = function() { // Call a function when the state changes.
|
||||
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
|
||||
resolve(JSON.parse(this.responseText));
|
||||
}
|
||||
reject(xhr.responseText);
|
||||
};
|
||||
xhr.send();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue