home and about page

This commit is contained in:
Schneider Roland
2025-01-26 11:06:15 +01:00
parent 86dda89db9
commit 04c436cb34
76 changed files with 2036 additions and 176 deletions

View File

@@ -0,0 +1,43 @@
import httpClient from "@/api/http-client";
import {Payload} from "@/types/generated-strapi-interfaces/common/Payload";
const STRAPI_URL = process.env.STRAPI_URL;
class StrapiClient{
constructor(private strapiUrl: string = "http://localhost:1337") {
}
public getImageUrl(imagePath: string){
return this.strapiUrl + imagePath;
}
public async httpGet(path: string){
return await httpClient.httpGet(this.strapiUrl + path);
}
public async httpGetJson<T>(url: string): Promise<Payload<T>>{
const response = await this.httpGet(url);
return await response.json();
}
public async findContentType<T>(contentType: string,options?: FindContentOptions): Promise<Payload<T>>{
const searchParams = new URLSearchParams();
if ( options?.populateAll ){
searchParams.append("populate","*");
}
if (options?.localeAll){
searchParams.append("_locale","all");
}
const response = await this.httpGet("/api/"+contentType+"?"+searchParams.toString());
return await response.json();
}
}
export interface FindContentOptions{
populateAll?: boolean;
localeAll?: boolean;
}
const client = new StrapiClient(STRAPI_URL);
export default client;