mock fetch call to allowed children of a doc type

This commit is contained in:
Mads Rasmussen
2023-03-14 11:53:37 +01:00
parent 77bd8b7a3d
commit a2260c4fe9

View File

@@ -194,6 +194,23 @@ export class UmbDocumentTypeServerDataSource implements RepositoryDetailDataSour
* @memberof UmbDocumentTypeServerDataSource
*/
async getAllowedChildrenOf(key: string) {
alert('get allowed children of', key);
if (!key) throw new Error('Key is missing');
let problemDetails: ProblemDetailsModel | undefined = undefined;
let data = undefined;
try {
const res = await fetch(`/umbraco/management/api/v1/document-type/allowed-children-of/${key}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
data = await res.json();
} catch (error) {
problemDetails = { title: `Get allowed children of ${key} failed` };
}
return { data, error: problemDetails };
}
}