Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(useStrapi): add optional query params to create / update in v5 #426

Merged

Conversation

BayBreezy
Copy link
Contributor

This change gives the developer the ability to send params while doing a create/update for Strapiv5.
The Strapi5RequestParams option was added to both functions.
I may be wrong about this so feel free to discard this PR if this is not a thing in v5(I am sure I read it somewhere)

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This change gives the developer the ability to send params while doing a create/update for Strapiv5.

I think Strapi allows you to do stuff like populate on create

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

Copy link

netlify bot commented Sep 27, 2024

👷 Deploy request for nuxt-strapi-module pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a323e95

* @returns Promise<T>
*/
const update = <T>(contentType: string, documentId: string | Partial<T>, data?: Partial<T>): Promise<Strapi5ResponseSingle<T>> => {
const update = <T>(contentType: string, documentId: string | Partial<T>, data?: Partial<T>, params: Strapi5RequestParams = {}): Promise<Strapi5ResponseSingle<T>> => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U probably wanted to assign the params to the client. In that case u'd fix pipelines.
return client(path, { method: 'PUT', body: { data }, params })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty. Idk how i missed that lol

@benjamincanac benjamincanac changed the title chore(useStrapi v5): add optional query params to the create & update… chore(useStrapi5): add optional query params to create / update Sep 30, 2024
@benjamincanac benjamincanac changed the title chore(useStrapi5): add optional query params to create / update chore(useStrapi): add optional query params to create / update in v5 Sep 30, 2024
@benjamincanac benjamincanac merged commit 0488bed into nuxt-modules:dev Sep 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants