fix: typings for attributeList store

This commit is contained in:
Torsten Dittmann committed 2022-09-15 12:22:38 +02:00
1 parent d406930742
commit 25d205d0af
1 file changed
+14 -3
@@ -96,16 +96,27 @@ export const indexList = cachedStore<
};
});
/**
* TODO: Mock proper types until the SKD is fixed.
*/
export type AttributeResponse = Omit<Models.AttributeList, 'attributes'> & {
attributes: Attributes[];
};
export const attributeList = cachedStore<
Models.AttributeList,
AttributeResponse,
{
load: (databaseId: string, collectionId: string) => Promise<void>;
}
>('attributeList', function ({ set }) {
return {
load: async (databaseId, collectionId) => {
const response = await sdkForProject.databases.listAttributes(databaseId, collectionId);
set(response);
const response: unknown = await sdkForProject.databases.listAttributes(
databaseId,
collectionId
);
set(response as AttributeResponse);
}
};
});