log user
Deskripsi: ganti log user dg cookies No Issues
This commit is contained in:
@@ -1,20 +1,26 @@
|
||||
import { prisma } from "@/module/_global";
|
||||
import { funDetectCookies, funGetUserByCookies } from "@/module/auth";
|
||||
|
||||
export default async function createLogUser({ act, desc, table, data }: { act: string, desc: string, table: string, data: string }) {
|
||||
try {
|
||||
|
||||
// diambil dari cookies
|
||||
const user = 'devAmalia'
|
||||
// cek cookies
|
||||
const cek = await funDetectCookies()
|
||||
if (cek) {
|
||||
const user = await funGetUserByCookies()
|
||||
|
||||
await prisma.userLog.create({
|
||||
data: {
|
||||
idUser: user,
|
||||
action: act,
|
||||
desc: desc,
|
||||
idContent: data,
|
||||
tbContent: table
|
||||
}
|
||||
})
|
||||
await prisma.userLog.create({
|
||||
data: {
|
||||
idUser: String(user.id),
|
||||
action: act,
|
||||
desc: desc,
|
||||
idContent: data,
|
||||
tbContent: table
|
||||
}
|
||||
})
|
||||
|
||||
return { success: true, message: "Success" }
|
||||
}
|
||||
|
||||
return { success: true, message: "Success" }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user