Skip to content

'notFound' template not return current user query #44

Answered by AlonsoK28
AlonsoK28 asked this question in Q&A
Discussion options

You must be logged in to vote

for me a workaround was like the following:

notFound: () => {
        const query = document.querySelector('#searchInputTypeahead').value;
        const slug = gen(generateSlugSearch(query), slugTypes.search);
        const template = `
          <div class="d-flex flex-column align-items-center justify-content-center">
            <span>Aun no hemos encontrado resultados</span>
            <button class="btn btn-primary my-2" type="submit" onclick="window.location.href = '${slug}'">
                <div class="d-flex align-items-center">
                    <i class="fas fa-search pe-1"></i>
                    Ampliar más la búsqueda
                </div>
            </button>

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@niketpathak
Comment options

Comment options

You must be logged in to vote
1 reply
@niketpathak
Comment options

Answer selected by niketpathak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants