Next.js Discord

Discord Forum

revalidate doesnt work

Unanswered
Akita posted this in #help-forum
Open in Discord
AkitaOP
// fetch function
async function fetchResult() {
    const res = await fetch(returnApiUrl('/api/events'), {
        next: {
            tags: ['events']
        },
    })

    if(!res.ok)
        throw new Error('Internal Server Error!')

    const { result } = await res.json() as ApiResponse<EventInterface[]>

    return result
}


function createEvent() {
    // add new line
    revalidateTag('events')
    return true;
}

This is my code. On dev mode it works, but on production i dont get the new values.

0 Replies