upd: api address
Deskripsi: - hapus semua penggunaan api address - fungetall member in index No Issues
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
export const API_ADDRESS = {
|
||||
// Group
|
||||
"apiGetAllGroup": "/api/group/get?path=get-all-group",
|
||||
"apiGetOneGroup": "/api/group/get?path=get-one-group",
|
||||
"apiCreateGroup": "/api/group/post?path=create-group",
|
||||
"apiUpdateGroup": "/api/group/post?path=update-group",
|
||||
"apiDeleteGroup": "/api/group/post?path=delete-group",
|
||||
|
||||
// User
|
||||
"apiGetAllUser": "/api/user/get?path=get-all-users",
|
||||
"apiGetOneUser": "/api/user/get?path=get-one-users",
|
||||
"apiCreateUser": "/api/user/post?path=create-users",
|
||||
"apiUpdateUser": "/api/user/post?path=update-users",
|
||||
"apiDeleteUser": "/api/user/post?path=delete-users",
|
||||
"apiGetRoleUser": "/api/user/get?path=get-role-user",
|
||||
|
||||
// Announcement
|
||||
"apiGetAllAnnouncement": "/api/announcement/get?path=get-all-announcement",
|
||||
"apiGetOneAnnouncement": "/api/announcement/get?path=get-one-announcement",
|
||||
"apiGetUserAnnouncement": "/api/announcement/get?path=get-user-announcement",
|
||||
"apiCreateAnnouncement": "/api/announcement/post?path=create-announcement",
|
||||
"apiUpdateAnnouncement": "/api/announcement/post?path=update-announcement",
|
||||
"apiDeleteAnnouncement": "/api/announcement/post?path=delete-announcement",
|
||||
|
||||
// Village
|
||||
"apiGetAllVillage": "/api/village/get?path=get-all-village",
|
||||
"apiGetOneVillage": "/api/village/get?path=get-one-village",
|
||||
"apiCreateVillage": "/api/village/post?path=create-village",
|
||||
"apiUpdateVillage": "/api/village/post?path=update-village",
|
||||
"apiDeleteVillage": "/api/village/post?path=delete-village",
|
||||
|
||||
// Position
|
||||
"apiGetAllPosition": "/api/position/get?path=get-all-position",
|
||||
"apiGetOnePosition": "/api/position/get?path=get-one-position",
|
||||
"apiCreatePosition": "/api/position/post?path=create-position",
|
||||
"apiUpdatePosition": "/api/position/post?path=update-position",
|
||||
"apiDeletePosition": "/api/position/post?path=delete-position",
|
||||
|
||||
|
||||
// Division
|
||||
"apiGetAllDivision": "/api/division/get?path=get-all-division",
|
||||
"apiGetOneDivision": "/api/division/get?path=get-one-division",
|
||||
"apiGetOneDetailDivision": "/api/division/get?path=get-one-detail-division",
|
||||
"apiCreateDivision": "/api/division/post?path=create-division",
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import { API_ADDRESS } from "./bin/api_address";
|
||||
import prisma from "./bin/prisma";
|
||||
import { pwd_key_config } from "./bin/val_global";
|
||||
import SkeletonSingle from "./components/skeleton_single";
|
||||
@@ -21,5 +20,4 @@ export { LayoutNavbarNew };
|
||||
export { ViewFilter };
|
||||
export { prisma };
|
||||
export { pwd_key_config };
|
||||
export { API_ADDRESS };
|
||||
export {SkeletonSingle}
|
||||
@@ -1,5 +1,4 @@
|
||||
"use client"
|
||||
import { API_ADDRESS } from "@/module/_global";
|
||||
import { Box, Flex, Grid, Group, Spoiler, Stack, Text } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useState } from "react";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import { API_ADDRESS, WARNA } from '@/module/_global';
|
||||
import { WARNA } from '@/module/_global';
|
||||
import { ActionIcon, Box, Center, Divider, Grid, Group, Spoiler, Text, TextInput } from '@mantine/core';
|
||||
import React, { useState } from 'react';
|
||||
import { TfiAnnouncement } from "react-icons/tfi";
|
||||
|
||||
@@ -1,53 +1,18 @@
|
||||
"use client"
|
||||
import { API_ADDRESS, LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||
import LayoutModal from '@/module/_global/layout/layout_modal';
|
||||
import { funGetUserByCookies } from '@/module/auth';
|
||||
import { TypeUser } from '@/module/user';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { funGetAllmember, TypeUser } from '@/module/user';
|
||||
import { Avatar, Box, Button, Divider, Group, Stack, Text, TextInput } from '@mantine/core';
|
||||
import { useParams, useRouter } from 'next/navigation';
|
||||
import React, { useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
import { FaCheck } from 'react-icons/fa6';
|
||||
import { HiMagnifyingGlass } from 'react-icons/hi2';
|
||||
import { globalMemberDivision } from '../lib/val_division';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import { funGetAllmember } from '@/module/user/member/lib/api_member';
|
||||
import { IDataMemberDivision } from '../lib/type_division';
|
||||
import { funAddDivisionMember, funGetDivisionById } from '../lib/api_division';
|
||||
|
||||
const dataUser = [
|
||||
{
|
||||
id: 1,
|
||||
img: "https://i.pravatar.cc/1000?img=3",
|
||||
name: "Doni Setiawan",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
img: "https://i.pravatar.cc/1000?img=10",
|
||||
name: "Ilham Udin",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
img: "https://i.pravatar.cc/1000?img=11",
|
||||
name: "Didin Anang",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
img: "https://i.pravatar.cc/1000?img=21",
|
||||
name: "Angga Saputra",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
img: "https://i.pravatar.cc/1000?img=32",
|
||||
name: "Marcel Widianto",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
img: "https://i.pravatar.cc/1000?img=37",
|
||||
name: "Bagas Nusantara",
|
||||
},
|
||||
];
|
||||
|
||||
export default function CreateAnggotaDivision() {
|
||||
const router = useRouter()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { API_ADDRESS, LayoutNavbarNew, WARNA } from "@/module/_global";
|
||||
import { LayoutNavbarNew, WARNA } from "@/module/_global";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import {
|
||||
Avatar,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import { API_ADDRESS, LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||
import { LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||
import { ActionIcon, Avatar, Box, Card, Center, Divider, Flex, Grid, Group, Text, TextInput, Title } from '@mantine/core';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client"
|
||||
import { API_ADDRESS, LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Avatar, Box, Button, Checkbox, Divider, Flex, Group, Stack, Text, TextInput } from '@mantine/core';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"use client"
|
||||
import { API_ADDRESS, LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Avatar, Box, Button, Center, Input, SimpleGrid, Stack, Text, TextInput } from '@mantine/core';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import React, { useState } from 'react';
|
||||
import { HiMagnifyingGlass } from 'react-icons/hi2';
|
||||
import { TypeUser } from '@/module/user';
|
||||
import { funGetAllmember, TypeUser } from '@/module/user';
|
||||
import { funGetUserByCookies } from '@/module/auth';
|
||||
import toast from 'react-hot-toast';
|
||||
import { globalMemberDivision } from '../lib/val_division';
|
||||
@@ -22,21 +22,26 @@ export default function NavbarCreateUsers({ grup, onClose }: { grup?: string, on
|
||||
if (selectedFiles.some((i: any) => i.id == dataMember[index].id)) {
|
||||
setSelectedFiles(selectedFiles.filter((i: any) => i.id != dataMember[index].id))
|
||||
} else {
|
||||
setSelectedFiles([...selectedFiles, {idUser: dataMember[index].id, name: dataMember[index].name}])
|
||||
setSelectedFiles([...selectedFiles, { idUser: dataMember[index].id, name: dataMember[index].name }])
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
async function loadData() {
|
||||
const loadMember = await fetch(API_ADDRESS.apiGetAllUser + '&active=true&groupID=' + grup);
|
||||
async function loadData(search: string) {
|
||||
const res = await funGetAllmember('?active=true&group=' + grup + '&search=' + search);
|
||||
const user = await funGetUserByCookies();
|
||||
const hasil = await loadMember.json()
|
||||
setDataMember(hasil.filter((i: any) => i.id != user.id))
|
||||
|
||||
// cek data member sebelumnya
|
||||
if (member.length > 0) {
|
||||
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
||||
if (res.success) {
|
||||
setDataMember(res.data.filter((i: any) => i.id != user.id))
|
||||
|
||||
// cek data member sebelumnya
|
||||
if (member.length > 0) {
|
||||
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
||||
}
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +54,7 @@ export default function NavbarCreateUsers({ grup, onClose }: { grup?: string, on
|
||||
}
|
||||
|
||||
useShallowEffect(() => {
|
||||
loadData()
|
||||
loadData("")
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -69,6 +74,7 @@ export default function NavbarCreateUsers({ grup, onClose }: { grup?: string, on
|
||||
radius={30}
|
||||
leftSection={<HiMagnifyingGlass size={20} />}
|
||||
placeholder="Pencarian"
|
||||
onChange={(e) => loadData(e.target.value)}
|
||||
/>
|
||||
<Box pt={10}>
|
||||
<SimpleGrid
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { API_ADDRESS, LayoutDrawer, WARNA } from "@/module/_global";
|
||||
import { LayoutDrawer, WARNA } from "@/module/_global";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { API_ADDRESS, LayoutDrawer, WARNA } from "@/module/_global";
|
||||
import { LayoutDrawer, WARNA } from "@/module/_global";
|
||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||
import {
|
||||
Box,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { API_ADDRESS, LayoutDrawer, SkeletonSingle, WARNA } from "@/module/_global";
|
||||
import { LayoutDrawer, SkeletonSingle, WARNA } from "@/module/_global";
|
||||
import {
|
||||
ActionIcon,
|
||||
Box,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { API_ADDRESS, LayoutDrawer, WARNA } from "@/module/_global"
|
||||
import { LayoutDrawer, WARNA } from "@/module/_global"
|
||||
import LayoutModal from "@/module/_global/layout/layout_modal"
|
||||
import { funGetAllGroup, IDataGroup } from "@/module/group"
|
||||
import { Box, Stack, SimpleGrid, Flex, Text, Select, TextInput, Button } from "@mantine/core"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WARNA, LayoutDrawer, API_ADDRESS } from "@/module/_global";
|
||||
import { WARNA, LayoutDrawer } from "@/module/_global";
|
||||
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
||||
import { Box, Stack, SimpleGrid, Flex, TextInput, Button, Text, Select } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { API_ADDRESS, LayoutDrawer, SkeletonSingle, WARNA } from "@/module/_global";
|
||||
import { LayoutDrawer, SkeletonSingle, WARNA } from "@/module/_global";
|
||||
import { ActionIcon, Box, Group, Text, TextInput } from "@mantine/core";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { FaUserTie } from "react-icons/fa6";
|
||||
|
||||
@@ -3,9 +3,11 @@ import { apiUser } from "./api/api_user";
|
||||
import createLogUser from "./log/fun/createLogUser";
|
||||
import ViewEditProfile from "./profile/view/view_edit_profile";
|
||||
import ViewProfile from "./profile/view/view_profile";
|
||||
import { funGetAllmember } from './member/lib/api_member';
|
||||
|
||||
export { ViewProfile };
|
||||
export { ViewEditProfile };
|
||||
export { apiUser };
|
||||
export { createLogUser };
|
||||
export type { TypeUser }
|
||||
export { funGetAllmember }
|
||||
|
||||
@@ -8,4 +8,4 @@ export { NavbarListMember }
|
||||
export { ListMember }
|
||||
export { CreateMember }
|
||||
export { NavbarDetailMember }
|
||||
export {EditMember}
|
||||
export {EditMember}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { API_ADDRESS, WARNA } from "@/module/_global";
|
||||
import { WARNA } from "@/module/_global";
|
||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
||||
import { Box, Button, Select, Stack, TextInput } from "@mantine/core";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { API_ADDRESS, WARNA } from "@/module/_global";
|
||||
import { WARNA } from "@/module/_global";
|
||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||
import { Box, Flex, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
@@ -28,7 +28,7 @@ export default function DrawerDetailMember({
|
||||
isActive: status,
|
||||
});
|
||||
|
||||
if (res.success) {
|
||||
if (res.success) {
|
||||
toast.success(res.message);
|
||||
onDeleted(true);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import { API_ADDRESS, WARNA } from "@/module/_global";
|
||||
import { WARNA } from "@/module/_global";
|
||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
||||
import { funGetAllPosition } from "@/module/position/lib/api_position";
|
||||
@@ -13,7 +13,7 @@ import { IDataPositionMember, IDataROleMember, IEditDataMember, IFormMember } fr
|
||||
import { funEditMember, funGetOneMember, funGetRoleUser } from "../lib/api_member";
|
||||
|
||||
|
||||
export default function EditMember({ id }: { id: string}) {
|
||||
export default function EditMember({ id }: { id: string }) {
|
||||
const [isModal, setModal] = useState(false)
|
||||
const router = useRouter()
|
||||
const [listGroup, setListGorup] = useState<IDataGroup[]>([])
|
||||
@@ -47,7 +47,7 @@ export default function EditMember({ id }: { id: string}) {
|
||||
|
||||
async function getOneData() {
|
||||
try {
|
||||
const res = await funGetOneMember(id)
|
||||
const res = await funGetOneMember(id)
|
||||
setData(res.data)
|
||||
getAllPosition(res.data?.idGroup)
|
||||
} catch (error) {
|
||||
@@ -59,8 +59,8 @@ export default function EditMember({ id }: { id: string}) {
|
||||
try {
|
||||
const res = await funGetAllPosition(
|
||||
"?active=true" + "&group=" + `${val}`
|
||||
);
|
||||
setListPosition(res.data);
|
||||
);
|
||||
setListPosition(res.data);
|
||||
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@@ -96,7 +96,7 @@ export default function EditMember({ id }: { id: string}) {
|
||||
async function onSubmit(val: boolean) {
|
||||
try {
|
||||
|
||||
const res = await funEditMember(id,{
|
||||
const res = await funEditMember(id, {
|
||||
id: data.id,
|
||||
nik: data.nik,
|
||||
name: data.name,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import { LayoutNavbarHome, LayoutIconBack, WARNA, LayoutDrawer, API_ADDRESS } from "@/module/_global";
|
||||
import { LayoutNavbarHome, LayoutIconBack, WARNA, LayoutDrawer } from "@/module/_global";
|
||||
import { Box, Group, ActionIcon, Stack, Text, Center, Avatar } from "@mantine/core";
|
||||
import { HiMenu } from "react-icons/hi";
|
||||
import { HiUser } from "react-icons/hi2";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import { API_ADDRESS, WARNA } from "@/module/_global"
|
||||
import { WARNA } from "@/module/_global"
|
||||
import { Box, Group, ActionIcon, Text, TextInput } from "@mantine/core"
|
||||
import { useShallowEffect } from "@mantine/hooks"
|
||||
import { useRouter, useSearchParams } from "next/navigation"
|
||||
|
||||
Reference in New Issue
Block a user