Skip to content

support SSR requests #117

@Baroshem

Description

@Baroshem

Is your feature request related to a problem? Please describe.

This topic have appeared some time ago but back then, I was not able to make it work. Today I managed to find a way to be able to send a request to Algolia from useAsyncData but it is not very elegant.

const { pending } = await useAsyncData('test', async () => {
  app.$algolia.transporter.requester = await (await import('@algolia/requester-node-http').then(lib => lib.default || lib)).createNodeHttpRequester()

  await search({ query: 'Samsung' })
})

As a part of this issue, I would like to create a new configuration entry nodeRequester that when set to true, it will create a new global object in nuxt App called algoliaNode so that later in useAlgoliaSearch composable users could do something like this:

const { pending } = await useAsyncData('test', () => search({ query: 'Samsung' , requester: 'node'}))

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions