Merge pull request 'amalia/19-jan-26' (#9) from amalia/19-jan-26 into join
Reviewed-on: http://wibugit.wibudev.com/wibu/mobile-darmasaba/pulls/9
This commit is contained in:
@@ -4,6 +4,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ButtonSelect from "@/components/buttonSelect";
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import DrawerBottom from "@/components/drawerBottom";
|
import DrawerBottom from "@/components/drawerBottom";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingOverlay from "@/components/loadingOverlay";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
@@ -153,6 +154,7 @@ export default function CreateAnnouncement() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<LoadingOverlay visible={loading} />
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100]}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ButtonSelect from "@/components/buttonSelect";
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import DrawerBottom from "@/components/drawerBottom";
|
import DrawerBottom from "@/components/drawerBottom";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingOverlay from "@/components/loadingOverlay";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
||||||
import Text from '@/components/Text';
|
import Text from '@/components/Text';
|
||||||
@@ -204,6 +205,7 @@ export default function EditAnnouncement() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<LoadingOverlay visible={loading} />
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100]}
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ export default function DetailDiscussionGeneral() {
|
|||||||
handleLoad('detail', false)
|
handleLoad('detail', false)
|
||||||
handleLoad('komentar', false)
|
handleLoad('komentar', false)
|
||||||
handleLoad('cek-anggota', false)
|
handleLoad('cek-anggota', false)
|
||||||
|
handleLoad('file', false)
|
||||||
}, [update]);
|
}, [update]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import ButtonSelect from "@/components/buttonSelect";
|
|||||||
import DrawerBottom from "@/components/drawerBottom";
|
import DrawerBottom from "@/components/drawerBottom";
|
||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingOverlay from "@/components/loadingOverlay";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import ModalSelect from "@/components/modalSelect";
|
import ModalSelect from "@/components/modalSelect";
|
||||||
import SelectForm from "@/components/selectForm";
|
import SelectForm from "@/components/selectForm";
|
||||||
@@ -185,6 +186,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<LoadingOverlay visible={loading} />
|
||||||
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ButtonSelect from "@/components/buttonSelect";
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import DrawerBottom from "@/components/drawerBottom";
|
import DrawerBottom from "@/components/drawerBottom";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingOverlay from "@/components/loadingOverlay";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiEditDiscussionGeneral, apiGetDiscussionGeneralOne } from "@/lib/api";
|
import { apiEditDiscussionGeneral, apiGetDiscussionGeneralOne } from "@/lib/api";
|
||||||
@@ -182,6 +183,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<LoadingOverlay visible={loading} />
|
||||||
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ButtonSelect from "@/components/buttonSelect";
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import DrawerBottom from "@/components/drawerBottom";
|
import DrawerBottom from "@/components/drawerBottom";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingOverlay from "@/components/loadingOverlay";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
@@ -27,7 +28,9 @@ export default function DiscussionDivisionEdit() {
|
|||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [fileForm, setFileForm] = useState<any[]>([])
|
const [fileForm, setFileForm] = useState<any[]>([])
|
||||||
const [isModalFile, setModalFile] = useState(false)
|
const [isModalFile, setModalFile] = useState(false)
|
||||||
const [indexDelFile, setIndexDelFile] = useState<number>(0)
|
const [indexDelFile, setIndexDelFile] = useState<{ id: string | number; cat: "newFile" | "oldFile" }>({ id: "", cat: "newFile" })
|
||||||
|
const [dataFile, setDataFile] = useState<{ id: string; idStorage: string; name: string; extension: string; delete?: boolean }[]>([])
|
||||||
|
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
@@ -37,6 +40,12 @@ export default function DiscussionDivisionEdit() {
|
|||||||
user: hasil,
|
user: hasil,
|
||||||
cat: "data",
|
cat: "data",
|
||||||
});
|
});
|
||||||
|
const response2 = await apiGetDiscussionOne({
|
||||||
|
id: detail,
|
||||||
|
user: hasil,
|
||||||
|
cat: "file",
|
||||||
|
});
|
||||||
|
setDataFile(response2.data);
|
||||||
setData(response.data.desc);
|
setData(response.data.desc);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@@ -51,10 +60,26 @@ export default function DiscussionDivisionEdit() {
|
|||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiEditDiscussion({
|
const fd = new FormData()
|
||||||
data: { user: hasil, desc: data },
|
for (let i = 0; i < fileForm.length; i++) {
|
||||||
id: detail,
|
fd.append(`file${i}`, {
|
||||||
});
|
uri: fileForm[i].uri,
|
||||||
|
type: 'application/octet-stream',
|
||||||
|
name: fileForm[i].name,
|
||||||
|
} as any);
|
||||||
|
}
|
||||||
|
|
||||||
|
fd.append("data", JSON.stringify(
|
||||||
|
{
|
||||||
|
user: hasil, desc: data, oldFile: dataFile
|
||||||
|
}
|
||||||
|
))
|
||||||
|
const response = await apiEditDiscussion(fd, detail);
|
||||||
|
|
||||||
|
// const response = await apiEditDiscussion({
|
||||||
|
// data: { user: hasil, desc: data },
|
||||||
|
// id: detail,
|
||||||
|
// });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
||||||
@@ -86,8 +111,18 @@ export default function DiscussionDivisionEdit() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function deleteFile(index: number) {
|
function deleteFile(index: number | string, cat: "newFile" | "oldFile" | null) {
|
||||||
setFileForm([...fileForm.filter((val, i) => i !== index)])
|
if (cat == "newFile") {
|
||||||
|
setFileForm([...fileForm.filter((val, i) => i !== index)])
|
||||||
|
} else {
|
||||||
|
setDataFile(prev =>
|
||||||
|
prev.map(item =>
|
||||||
|
item.id === index
|
||||||
|
? { ...item, delete: true }
|
||||||
|
: item
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
setModalFile(false)
|
setModalFile(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +150,8 @@ export default function DiscussionDivisionEdit() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<LoadingOverlay visible={loading} />
|
||||||
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Diskusi"
|
label="Diskusi"
|
||||||
@@ -129,10 +165,22 @@ export default function DiscussionDivisionEdit() {
|
|||||||
|
|
||||||
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
||||||
{
|
{
|
||||||
fileForm.length > 0
|
(fileForm.length > 0 || dataFile.filter((val) => !val.delete).length > 0)
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10, Styles.mb10]}>
|
<View style={[Styles.borderAll, Styles.round10, Styles.p10, Styles.mb10]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
|
{
|
||||||
|
dataFile.filter((val) => !val.delete).map((item, index) => (
|
||||||
|
<BorderBottomItem
|
||||||
|
key={index}
|
||||||
|
borderType={(fileForm.length + dataFile.length) > 1 ? "bottom" : "none"}
|
||||||
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
||||||
|
title={item.name + '.' + item.extension}
|
||||||
|
titleWeight="normal"
|
||||||
|
onPress={() => { setIndexDelFile({ id: item.id, cat: "oldFile" }); setModalFile(true) }}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
{
|
{
|
||||||
fileForm.map((item, index) => (
|
fileForm.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
@@ -141,7 +189,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
titleWeight="normal"
|
titleWeight="normal"
|
||||||
onPress={() => { setIndexDelFile(index); setModalFile(true) }}
|
onPress={() => { setIndexDelFile({ id: index, cat: "newFile" }); setModalFile(true) }}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -156,7 +204,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash" color="black" size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile) }}
|
onPress={() => { deleteFile(indexDelFile.id, indexDelFile.cat) }}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|||||||
@@ -56,10 +56,18 @@ type PropsComment = {
|
|||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type PropsFile = {
|
||||||
|
id: string;
|
||||||
|
idStorage: string;
|
||||||
|
name: string;
|
||||||
|
extension: string
|
||||||
|
}
|
||||||
|
|
||||||
export default function DiscussionDetail() {
|
export default function DiscussionDetail() {
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
||||||
const [data, setData] = useState<Props>();
|
const [data, setData] = useState<Props>();
|
||||||
const [dataComment, setDataComment] = useState<PropsComment[]>([]);
|
const [dataComment, setDataComment] = useState<PropsComment[]>([]);
|
||||||
|
const [fileDiscussion, setFileDiscussion] = useState<PropsFile[]>([])
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [komentar, setKomentar] = useState("");
|
const [komentar, setKomentar] = useState("");
|
||||||
const [loadingSend, setLoadingSend] = useState(false);
|
const [loadingSend, setLoadingSend] = useState(false);
|
||||||
@@ -114,7 +122,15 @@ export default function DiscussionDetail() {
|
|||||||
user: hasil,
|
user: hasil,
|
||||||
cat: "data",
|
cat: "data",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const responseFile = await apiGetDiscussionOne({
|
||||||
|
id: detail,
|
||||||
|
user: hasil,
|
||||||
|
cat: "file",
|
||||||
|
});
|
||||||
|
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
|
setFileDiscussion(responseFile.data)
|
||||||
setIsCreator(response.data.createdBy == hasil);
|
setIsCreator(response.data.createdBy == hasil);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@@ -290,6 +306,7 @@ export default function DiscussionDetail() {
|
|||||||
<SkeletonContent />
|
<SkeletonContent />
|
||||||
:
|
:
|
||||||
<BorderBottomItem2
|
<BorderBottomItem2
|
||||||
|
dataFile={fileDiscussion}
|
||||||
descEllipsize={false}
|
descEllipsize={false}
|
||||||
borderType="bottom"
|
borderType="bottom"
|
||||||
icon={
|
icon={
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader"
|
|||||||
import ButtonSelect from "@/components/buttonSelect"
|
import ButtonSelect from "@/components/buttonSelect"
|
||||||
import DrawerBottom from "@/components/drawerBottom"
|
import DrawerBottom from "@/components/drawerBottom"
|
||||||
import { InputForm } from "@/components/inputForm"
|
import { InputForm } from "@/components/inputForm"
|
||||||
|
import LoadingOverlay from "@/components/loadingOverlay"
|
||||||
import MenuItemRow from "@/components/menuItemRow"
|
import MenuItemRow from "@/components/menuItemRow"
|
||||||
import Text from "@/components/Text"
|
import Text from "@/components/Text"
|
||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
@@ -54,7 +55,23 @@ export default function CreateDiscussionDivision() {
|
|||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiCreateDiscussion({ data: { user: hasil, desc, idDivision: id } })
|
const fd = new FormData()
|
||||||
|
|
||||||
|
for (let i = 0; i < fileForm.length; i++) {
|
||||||
|
fd.append(`file${i}`, {
|
||||||
|
uri: fileForm[i].uri,
|
||||||
|
type: 'application/octet-stream',
|
||||||
|
name: fileForm[i].name,
|
||||||
|
} as any);
|
||||||
|
}
|
||||||
|
|
||||||
|
fd.append("data", JSON.stringify(
|
||||||
|
{ user: hasil, desc, idDivision: id }
|
||||||
|
))
|
||||||
|
|
||||||
|
const response = await apiCreateDiscussion(fd)
|
||||||
|
|
||||||
|
// const response = await apiCreateDiscussion({ data: { user: hasil, desc, idDivision: id } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
||||||
@@ -85,7 +102,8 @@ export default function CreateDiscussionDivision() {
|
|||||||
}} />
|
}} />
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<LoadingOverlay visible={loading} />
|
||||||
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Diskusi"
|
label="Diskusi"
|
||||||
|
|||||||
50
components/loadingOverlay.tsx
Normal file
50
components/loadingOverlay.tsx
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { View, ActivityIndicator, StyleSheet, Text } from "react-native";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
visible: boolean;
|
||||||
|
text?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function LoadingOverlay({
|
||||||
|
visible,
|
||||||
|
text = "Loading...",
|
||||||
|
}: Props) {
|
||||||
|
if (!visible) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={styles.overlay}>
|
||||||
|
<View style={styles.box}>
|
||||||
|
<ActivityIndicator size="small" color="#2c3e50" />
|
||||||
|
<Text style={styles.text}>{text}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
overlay: {
|
||||||
|
...StyleSheet.absoluteFillObject,
|
||||||
|
backgroundColor: "rgba(0,0,0,0.35)",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
zIndex: 9999,
|
||||||
|
},
|
||||||
|
box: {
|
||||||
|
paddingVertical: 5,
|
||||||
|
paddingHorizontal: 15,
|
||||||
|
backgroundColor: "#fff",
|
||||||
|
borderRadius: 8,
|
||||||
|
alignItems: "center",
|
||||||
|
elevation: 6, // Android
|
||||||
|
shadowColor: "#000", // iOS
|
||||||
|
shadowOpacity: 0.25,
|
||||||
|
shadowRadius: 5,
|
||||||
|
shadowOffset: { width: 0, height: 4 },
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
marginTop: 5,
|
||||||
|
fontSize: 14,
|
||||||
|
color: "#2c3e50",
|
||||||
|
},
|
||||||
|
});
|
||||||
28
lib/api.ts
28
lib/api.ts
@@ -497,7 +497,7 @@ export const apiGetDiscussion = async ({ user, search, division, active, page }:
|
|||||||
return response.data;
|
return response.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const apiGetDiscussionOne = async ({ id, user, cat }: { id: string, user: string, cat: 'data' | 'comment' }) => {
|
export const apiGetDiscussionOne = async ({ id, user, cat }: { id: string, user: string, cat: 'data' | 'comment' | 'file' }) => {
|
||||||
const response = await api.get(`mobile/discussion/${id}?user=${user}&cat=${cat}`);
|
const response = await api.get(`mobile/discussion/${id}?user=${user}&cat=${cat}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
};
|
};
|
||||||
@@ -517,8 +517,17 @@ export const apiDeleteDiscussionCommentar = async ({ data, id }: { data: { user:
|
|||||||
return response.data;
|
return response.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const apiEditDiscussion = async ({ data, id }: { data: { user: string, desc: string }, id: string }) => {
|
// export const apiEditDiscussion = async ({ data, id }: { data: { user: string, desc: string }, id: string }) => {
|
||||||
const response = await api.post(`/mobile/discussion/${id}`, data)
|
// const response = await api.post(`/mobile/discussion/${id}`, data)
|
||||||
|
// return response.data;
|
||||||
|
// };
|
||||||
|
|
||||||
|
export const apiEditDiscussion = async (data: FormData, id: string) => {
|
||||||
|
const response = await api.post(`/mobile/discussion/${id}`, data, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
},
|
||||||
|
})
|
||||||
return response.data;
|
return response.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -532,8 +541,17 @@ export const apiOpenCloseDiscussion = async (data: { user: string, status: numbe
|
|||||||
return response.data
|
return response.data
|
||||||
};
|
};
|
||||||
|
|
||||||
export const apiCreateDiscussion = async ({ data }: { data: { user: string, desc: string, idDivision: string } }) => {
|
// export const apiCreateDiscussion = async ({ data }: { data: { user: string, desc: string, idDivision: string } }) => {
|
||||||
const response = await api.post(`/mobile/discussion`, data)
|
// const response = await api.post(`/mobile/discussion`, data)
|
||||||
|
// return response.data;
|
||||||
|
// };
|
||||||
|
|
||||||
|
export const apiCreateDiscussion = async (data: FormData) => {
|
||||||
|
const response = await api.post(`/mobile/discussion`, data, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
},
|
||||||
|
})
|
||||||
return response.data;
|
return response.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user