generic functions for backend queries
This commit is contained in:
@@ -8,7 +8,8 @@ import { Button, Link } from "@components/index";
|
||||
import AddLink from "@components/AddLink";
|
||||
import Event from "@models/Event";
|
||||
import EventApi from "@api/eventApi";
|
||||
import useFetchEvents from "@hooks/useFetchEvents";
|
||||
import useFetchBackend from "@hooks/useFetchBackend";
|
||||
import { APIPath } from "@api/backend";
|
||||
|
||||
const URL = "/admin/events";
|
||||
|
||||
@@ -65,7 +66,7 @@ const renderData = (events: Event[]) => {
|
||||
};
|
||||
|
||||
const AdminEventPage: NextPage = () => {
|
||||
const { data } = useFetchEvents({ options: { auth: true } });
|
||||
const { data } = useFetchBackend<Event[]>({ apiPath: APIPath.EVENTS, options: { auth: true } });
|
||||
return (
|
||||
<AdminListCommon>
|
||||
<h1>Events</h1>
|
||||
|
||||
@@ -8,7 +8,8 @@ import { Button, Link } from "@components/index";
|
||||
import AddLink from "@components/AddLink";
|
||||
import Post from "@models/Feed";
|
||||
import PostApi from "@api/feedApi";
|
||||
import useFetchFeed from "@hooks/useFetchFeed";
|
||||
import useFetchBackend from "@hooks/useFetchBackend";
|
||||
import { APIPath } from "@api/backend";
|
||||
|
||||
const URL = "/admin/feed";
|
||||
|
||||
@@ -65,7 +66,7 @@ const renderData = (feed: Post[]) => {
|
||||
};
|
||||
|
||||
const AdminFeedPage: NextPage = () => {
|
||||
const { data } = useFetchFeed({ options: { auth: true } });
|
||||
const { data } = useFetchBackend<Post[]>({ apiPath: APIPath.FEED, options: { auth: true } });
|
||||
return (
|
||||
<AdminListCommon>
|
||||
<h1>Feed</h1>
|
||||
|
||||
@@ -7,8 +7,9 @@ import AdminListCommon from "@views/admin/AdminListCommon";
|
||||
import { Button, Link } from "@components/index";
|
||||
import AddLink from "@components/AddLink";
|
||||
import JobAd from "@models/JobAd";
|
||||
import useFetchJobAds from "@hooks/useFetchJobAds";
|
||||
import useFetchBackend from "@hooks/useFetchBackend";
|
||||
import JobAdApi from "@api/jobAdApi";
|
||||
import { APIPath } from "@api/backend";
|
||||
|
||||
const URL = "/admin/jobads";
|
||||
|
||||
@@ -69,7 +70,7 @@ const renderData = (jobAds: JobAd[]) => {
|
||||
};
|
||||
|
||||
const AdminJobAdPage: NextPage = () => {
|
||||
const { data } = useFetchJobAds({ options: { auth: true } });
|
||||
const { data } = useFetchBackend<JobAd[]>({ apiPath: APIPath.JOBADS, options: { auth: true } });
|
||||
return (
|
||||
<AdminListCommon>
|
||||
<h1>Job advertisements</h1>
|
||||
|
||||
Reference in New Issue
Block a user