-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e5600d
commit 5a5634e
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use server"; | ||
|
||
import { blockUser, unblockUser } from "@/lib/block-service"; | ||
import { revalidatePath } from "next/cache"; | ||
|
||
export const onBlock = async (id: string) => { | ||
const blockedUser = await blockUser(id); | ||
|
||
revalidatePath("/"); | ||
|
||
if (blockedUser) { | ||
revalidatePath(`/${blockedUser.blocked.username}`); | ||
} | ||
|
||
return blockedUser; | ||
}; | ||
|
||
export const onUnblock = async (id: string) => { | ||
const unblockedUser = await unblockUser(id); | ||
|
||
revalidatePath("/"); | ||
|
||
if (unblockedUser) { | ||
revalidatePath(`/${unblockedUser.blocked.username}`); | ||
} | ||
|
||
return unblockedUser; | ||
}; |