Skip to content

Commit

Permalink
Update actions.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Nov 21, 2024
1 parent f775940 commit 3a579cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions next-enterprise/src/app/actions.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
'use server'

import type {SyncTag} from '@sanity/client'
import {expireTag} from 'next/cache'
import {revalidateTag} from 'next/cache'

export async function randomColorTheme(tags: SyncTag[]) {
const res = await fetch('https://lcapi-examples-api.sanity.dev/api/random-color-theme', {
method: 'PUT',
})
expireTag(...tags)
for (const tag of tags) {
revalidateTag(tag)
}
return res.json()
}

0 comments on commit 3a579cc

Please sign in to comment.