File tree 1 file changed +3
-1
lines changed
packages/strapi-client/src/client 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ export class StrapiClient {
71
71
* @param entityName - The singular name of the entity you want to query/write
72
72
* @param id - The ID of the entity you want to query/write, or undefined
73
73
* @param params - The params to pass to the Strapi API
74
+ * @param isSingleType - Whether the entity is a single type
74
75
* @returns The endpoint URL
75
76
*/
76
77
public getEndpoint (
@@ -81,7 +82,8 @@ export class StrapiClient {
81
82
) : string {
82
83
const contentType = this . entityMap . get ( entityName ) ;
83
84
const query = qs . stringify ( params , { addQueryPrefix : true , encodeValuesOnly : true } ) ;
84
- return this . getUrl ( `${ contentType ?. path } ${ id ? `/${ id } ` : '' } ${ query } ` ) ;
85
+ const path = isSingleType ? contentType ?. singularName : pluralize ( contentType ?. singularName ) ;
86
+ return this . getUrl ( `/api/${ path } ${ id ? `/${ id } ` : '' } ${ query } ` ) ;
85
87
}
86
88
87
89
/**
You can’t perform that action at this time.
0 commit comments