Initial commit
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { BASE_URL } from "@/components/main/BaseUrl";
|
||||
import { normalizeUserLevel } from "@/lib/userLevel";
|
||||
|
||||
export async function fetchPosts(
|
||||
page: number,
|
||||
@@ -14,7 +15,12 @@ export async function fetchPosts(
|
||||
},
|
||||
token: string
|
||||
) {
|
||||
const validFilters = Object.entries(filters || {})
|
||||
const normalizedFilters = { ...filters };
|
||||
if (normalizedFilters.userLevel) {
|
||||
normalizedFilters.userLevel = normalizeUserLevel(normalizedFilters.userLevel);
|
||||
}
|
||||
|
||||
const validFilters = Object.entries(normalizedFilters || {})
|
||||
.filter(([value]) => value !== undefined && value !== "")
|
||||
.reduce((acc, [key, value]) => {
|
||||
acc[key] = value;
|
||||
|
||||
Reference in New Issue
Block a user