refactor: update subscription data loading and clean up unused imports in dashboard components
This commit is contained in:
parent
5b83c3f8dd
commit
a9a350fdb2
@ -5,24 +5,22 @@ import { Link, useRouteLoaderData } from 'react-router'
|
||||
import { Button } from '~/components/ui/button'
|
||||
import { UiTable } from '~/components/ui/table'
|
||||
import { TitleDashboard } from '~/components/ui/title-dashboard'
|
||||
import type { loader } from '~/routes/_admin.lg-admin._dashboard'
|
||||
import type { loader } from '~/routes/_admin.lg-admin._dashboard.subscribe-plan._index'
|
||||
|
||||
export const SubscribePlanPage = () => {
|
||||
const loaderData = useRouteLoaderData<typeof loader>(
|
||||
'routes/_admin.lg-admin._dashboard',
|
||||
'routes/_admin.lg-admin._dashboard.subscribe-plan._index',
|
||||
)
|
||||
|
||||
DataTable.use(DT)
|
||||
|
||||
const { subscriptionsData: dataTable } = loaderData || {}
|
||||
|
||||
const dataColumns = [
|
||||
{
|
||||
title: 'No',
|
||||
render: (
|
||||
data: unknown,
|
||||
type: unknown,
|
||||
row: unknown,
|
||||
_data: unknown,
|
||||
_type: unknown,
|
||||
_row: unknown,
|
||||
meta: { row: number },
|
||||
) => {
|
||||
return meta.row + 1
|
||||
@ -41,7 +39,6 @@ export const SubscribePlanPage = () => {
|
||||
data: 'id',
|
||||
},
|
||||
]
|
||||
|
||||
const dataSlot = {
|
||||
3: (value: string) => (
|
||||
<Button
|
||||
|
||||
@ -3,7 +3,6 @@ import DT from 'datatables.net-dt'
|
||||
import DataTable from 'datatables.net-react'
|
||||
|
||||
import { SearchIcon } from '~/components/icons/search'
|
||||
import { Button } from '~/components/ui/button'
|
||||
import { UiTable } from '~/components/ui/table'
|
||||
import { TitleDashboard } from '~/components/ui/title-dashboard'
|
||||
|
||||
@ -61,15 +60,6 @@ export const SubscriptionsPage = () => {
|
||||
</Field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
as="a"
|
||||
className="rounded-md"
|
||||
size="lg"
|
||||
href="#"
|
||||
>
|
||||
Subscription Settings
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<UiTable
|
||||
|
||||
@ -1,4 +1,11 @@
|
||||
import { getSubscriptions } from '~/apis/common/get-subscriptions'
|
||||
import { SubscribePlanPage } from '~/pages/dashboard-plan-subscribe'
|
||||
|
||||
import type { Route } from './+types/_admin.lg-admin._dashboard.contents._index'
|
||||
|
||||
export const loader = async ({}: Route.LoaderArgs) => {
|
||||
const { data: subscriptionsData } = await getSubscriptions()
|
||||
return { subscriptionsData }
|
||||
}
|
||||
const DashboardSubscriptionsSettingsLayout = () => <SubscribePlanPage />
|
||||
export default DashboardSubscriptionsSettingsLayout
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { Outlet } from 'react-router'
|
||||
|
||||
import { getCategories } from '~/apis/common/get-categories'
|
||||
import { getSubscriptions } from '~/apis/common/get-subscriptions'
|
||||
import { getTags } from '~/apis/common/get-tags'
|
||||
import { AdminDashboardLayout } from '~/layouts/admin/dashboard'
|
||||
|
||||
@ -10,12 +9,10 @@ import type { Route } from './+types/_admin.lg-admin._dashboard'
|
||||
export const loader = async ({}: Route.LoaderArgs) => {
|
||||
const { data: categoriesData } = await getCategories()
|
||||
const { data: tagsData } = await getTags()
|
||||
const { data: subscriptionsData } = await getSubscriptions()
|
||||
|
||||
return {
|
||||
categoriesData,
|
||||
tagsData,
|
||||
subscriptionsData,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user