Forum
Fix: - Tampilan beranda forum & bisa melakukan search dan sudah terintegrasi API - Fitur hapus edit dan ubah status sudah terintegrasi API - List komentar sudah bisa muncul dan bisa mengahpus ### No Issue
This commit is contained in:
@@ -11,7 +11,7 @@ export async function apiForumCreate({ data }: { data: any }) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiForumGetAll({search}: {search: string}) {
|
||||
export async function apiForumGetAll({ search }: { search: string }) {
|
||||
try {
|
||||
const response = await apiConfig.get(`/mobile/forum?search=${search}`);
|
||||
return response.data;
|
||||
@@ -19,3 +19,78 @@ export async function apiForumGetAll({search}: {search: string}) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiForumGetOne({ id }: { id: string }) {
|
||||
try {
|
||||
const response = await apiConfig.get(`/mobile/forum/${id}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiForumUpdate({ id, data }: { id: string; data: any }) {
|
||||
try {
|
||||
const response = await apiConfig.put(`/mobile/forum/${id}`, {
|
||||
data: data,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiForumUpdateStatus({ id, data }: { id: string; data: any }) {
|
||||
try {
|
||||
const response = await apiConfig.post(`/mobile/forum/${id}`, {
|
||||
data: data,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiForumDelete({ id }: { id: string }) {
|
||||
try {
|
||||
const response = await apiConfig.delete(`/mobile/forum/${id}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiForumCreateComment({
|
||||
id,
|
||||
data,
|
||||
}: {
|
||||
id: string;
|
||||
data: any;
|
||||
}) {
|
||||
try {
|
||||
const response = await apiConfig.post(`/mobile/forum/${id}/comment`, {
|
||||
data: data,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiForumGetComment({ id }: { id: string }) {
|
||||
try {
|
||||
const response = await apiConfig.get(`/mobile/forum/${id}/comment`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiForumDeleteComment({ id }: { id: string }) {
|
||||
try {
|
||||
const response = await apiConfig.delete(`/mobile/forum/${id}/comment`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import axios, { AxiosInstance } from "axios";
|
||||
import Constants from "expo-constants";
|
||||
export const BASE_URL = Constants.expoConfig?.extra?.BASE_URL;
|
||||
export const API_BASE_URL = Constants.expoConfig?.extra?.API_BASE_URL;
|
||||
|
||||
export const apiConfig: AxiosInstance = axios.create({
|
||||
|
||||
Reference in New Issue
Block a user