upd: mobile
Deskripsi: - api mobile home - server action detect user No Issues
This commit is contained in:
33
src/module/auth/api/funGetUserById.ts
Normal file
33
src/module/auth/api/funGetUserById.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
'use server'
|
||||
import { prisma } from "@/module/_global";
|
||||
|
||||
export default async function funGetUserById({ id }: { id: string }) {
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: id
|
||||
},
|
||||
});
|
||||
|
||||
const village = await prisma.village.findUnique({
|
||||
where: {
|
||||
id: user?.idVillage
|
||||
}
|
||||
})
|
||||
|
||||
const warna = await prisma.colorTheme.findUnique({
|
||||
where: {
|
||||
id: String(village?.idTheme)
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
id: user?.id,
|
||||
idUserRole: user?.idUserRole,
|
||||
name: user?.name,
|
||||
idVillage: user?.idVillage,
|
||||
idGroup: user?.idGroup,
|
||||
idPosition: user?.idPosition,
|
||||
theme: warna,
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,9 @@
|
||||
import funDetectCookies from "./api/funDetectCookies";
|
||||
import funGetUserByCookies from "./api/funGetUserByCookies";
|
||||
import funGetUserById from "./api/funGetUserById";
|
||||
import funSetCookies from "./api/funSetCookies";
|
||||
import ViewLogin from "./login/view/view_login";
|
||||
import ViewVerification from "./varification/view/view_verification";
|
||||
import { ViewWelcome } from "./welcome/view_welcome";
|
||||
|
||||
export { ViewLogin }
|
||||
export { ViewVerification }
|
||||
export { ViewWelcome }
|
||||
export { funSetCookies }
|
||||
export { funDetectCookies }
|
||||
export { funGetUserByCookies }
|
||||
export { funDetectCookies, funGetUserByCookies, funGetUserById, funSetCookies, ViewLogin, ViewVerification, ViewWelcome };
|
||||
|
||||
Reference in New Issue
Block a user