Updated the code to allow for images
This commit is contained in:
@@ -13,11 +13,10 @@ interface StrapiResponse<T> {
|
||||
meta: object;
|
||||
}
|
||||
|
||||
type Result<T> = {data: StrapiResponse<T>; isError: boolean};
|
||||
|
||||
export async function getData<T>(page: string, locale: "ar" | "en"): Promise<Result<T>> {
|
||||
export async function getData<T>(page: string, locale: "ar" | "en"): Promise<T> {
|
||||
const request = await axios.get<StrapiResponse<T>>(`${process.env.STRAPI_URL}/api/${page}/?populate=deep&locale=${locale}`, {
|
||||
headers: {Authorization: `Bearer ${process.env.STRAPI_TOKEN}`},
|
||||
});
|
||||
return {data: request.data, isError: request.status !== 200};
|
||||
|
||||
return request.data.data.attributes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user