upd: api mobile
Deskriipsi: - api announcement get all - api announcement create - api division get - api announcement get one No Issues
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { prisma } from "@/module/_global";
|
||||
import { funGetUserByCookies } from "@/module/auth";
|
||||
import { funGetUserById } from "@/module/auth";
|
||||
import { NextResponse } from "next/server";
|
||||
export const dynamic = 'force-dynamic'
|
||||
export const revalidate = true
|
||||
@@ -7,19 +7,23 @@ export const revalidate = true
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
const user = await funGetUserByCookies()
|
||||
if (user.id == undefined) {
|
||||
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
||||
const { searchParams } = new URL(request.url);
|
||||
const user = searchParams.get("user")
|
||||
const userMobile = await funGetUserById({ id: String(user) })
|
||||
|
||||
if (userMobile.id == "null" || userMobile.id == undefined || userMobile.id == "") {
|
||||
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 200 });
|
||||
}
|
||||
const role = user.idUserRole
|
||||
const villaId = user.idVillage
|
||||
const group = user.idGroup
|
||||
|
||||
const role = userMobile.idUserRole
|
||||
const villaId = userMobile.idVillage
|
||||
const group = userMobile.idGroup
|
||||
let kondisi: any = {
|
||||
isActive: true,
|
||||
idVillage: String(villaId)
|
||||
}
|
||||
|
||||
if (role != "supadmin") {
|
||||
if (role != "supadmin" && role != "developer") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
idVillage: String(villaId),
|
||||
|
||||
Reference in New Issue
Block a user