A plugin for Strapi Headless CMS that provides navigation / menu builder feature with their possibility to control the audience and different output structure renderers like (flat, tree and RFR - ready for handling by Redux First Router)
MIT License
318
stars
58
forks
source link
Typescript Types for REST API Response in Client code #352
Is there a npm package that provides the necessary type definitions for the client side?
To be more precise:
When requesting the api at /api/navigation/render/main-navigation in some client - what typescript type does the returned data have?
Example
Some client trying to fetch navigation data from a strapi backend via REST:
export async function getNavigation()
// : ???
{
const response = await fetch( "/api/navigation/render/main-navigation", {} );
if( ! response?.ok ) {
throw new Error( `Error when fetching data from '${url}': returned HTTP status '${response.status}'` );
}
const data = await response.json();
if( !data ) {
throw new Error( `Error when fetching data from '${url}': no data!` );
}
return data // as ???
}
Question
Is there a npm package that provides the necessary type definitions for the client side?
To be more precise: When requesting the api at
/api/navigation/render/main-navigation
in some client - what typescript type does the returned data have?Example
Some client trying to fetch navigation data from a strapi backend via REST: