Fix SetContainerList dictionary parsing
This commit is contained in:
parent
e32e98cddd
commit
8653be0172
2 changed files with 12 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
import { IConfiguration } from '../../Interfaces/IConfiguration';
|
||||
import { ISetContainerListRequest } from '../../Interfaces/ISetContainerListRequest';
|
||||
import { ISetContainerListResponse } from '../../Interfaces/ISetContainerListResponse';
|
||||
import { GetCircularReplacer } from '../../utils/saveload';
|
||||
import { GetCircularReplacerKeepDataStructure } from '../../utils/saveload';
|
||||
|
||||
/**
|
||||
* Fetch the configuration from the API
|
||||
|
@ -34,7 +34,7 @@ export async function FetchConfiguration(): Promise<IConfiguration> {
|
|||
|
||||
export async function SetContainerList(request: ISetContainerListRequest): Promise<ISetContainerListResponse> {
|
||||
const url = import.meta.env.VITE_API_POST_URL;
|
||||
const dataParsed = JSON.stringify(request, GetCircularReplacer());
|
||||
const dataParsed = JSON.stringify(request, GetCircularReplacerKeepDataStructure());
|
||||
// The test library cannot use the Fetch API
|
||||
// @ts-expect-error
|
||||
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
||||
|
|
|
@ -61,3 +61,13 @@ export function GetCircularReplacer(): (key: any, value: object | Map<string, an
|
|||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
export function GetCircularReplacerKeepDataStructure(): (key: any, value: object | Map<string, any> | null) => object | null | undefined {
|
||||
return (key: any, value: object | null) => {
|
||||
if (key === 'parent') {
|
||||
return;
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue