refactor: update route type imports for admin actions and remove unused types
This commit is contained in:
parent
70cbb134d8
commit
56c31d7a20
@ -12,7 +12,6 @@ const adsResponseSchema = z.object({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export type TAdResponse = z.infer<typeof adResponseSchema>
|
export type TAdResponse = z.infer<typeof adResponseSchema>
|
||||||
export type TAdsResponse = z.infer<typeof adsResponseSchema>
|
|
||||||
|
|
||||||
export const getAds = async (parameters?: THttpServer) => {
|
export const getAds = async (parameters?: THttpServer) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { isRouteErrorResponse } from 'react-router'
|
|||||||
import { getSubscriptions } from '~/apis/common/get-subscriptions'
|
import { getSubscriptions } from '~/apis/common/get-subscriptions'
|
||||||
import { SubscribePlanPage } from '~/pages/dashboard-plan-subscribe'
|
import { SubscribePlanPage } from '~/pages/dashboard-plan-subscribe'
|
||||||
|
|
||||||
import type { Route } from './+types/_admin.lg-admin._dashboard.contents._index'
|
import type { Route } from './+types/_admin.lg-admin._dashboard.subscribe-plan._index'
|
||||||
|
|
||||||
export const loader = async ({}: Route.LoaderArgs) => {
|
export const loader = async ({}: Route.LoaderArgs) => {
|
||||||
const { data: subscriptionsData } = await getSubscriptions()
|
const { data: subscriptionsData } = await getSubscriptions()
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { createAdsRequest } from '~/apis/admin/create-ads'
|
|||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { adsSchema, type TAdsSchema } from '~/pages/form-advertisements'
|
import { adsSchema, type TAdsSchema } from '~/pages/form-advertisements'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.advertisements.create'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { createCategoryRequest } from '~/apis/admin/create-category'
|
|||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { categorySchema, type TCategorySchema } from '~/pages/form-category'
|
import { categorySchema, type TCategorySchema } from '~/pages/form-category'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.categories.create'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { updateCategoryRequest } from '~/apis/admin/update-category'
|
|||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { categorySchema, type TCategorySchema } from '~/pages/form-category'
|
import { categorySchema, type TCategorySchema } from '~/pages/form-category'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.categories.update'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { createNewsRequest } from '~/apis/admin/create-news'
|
|||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { contentSchema, type TContentSchema } from '~/pages/form-contents'
|
import { contentSchema, type TContentSchema } from '~/pages/form-contents'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.contents.create'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { updateNewsRequest } from '~/apis/admin/update-news'
|
|||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { contentSchema, type TContentSchema } from '~/pages/form-contents'
|
import { contentSchema, type TContentSchema } from '~/pages/form-contents'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.contents.update'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { staffLoginRequest } from '~/apis/admin/login-staff'
|
|||||||
import { loginSchema, type TLoginSchema } from '~/pages/staff-login'
|
import { loginSchema, type TLoginSchema } from '~/pages/staff-login'
|
||||||
import { generateStaffTokenCookie } from '~/utils/token'
|
import { generateStaffTokenCookie } from '~/utils/token'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.login'
|
import type { Route } from './+types/actions.admin.login'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import {
|
|||||||
type TSubscribePlanSchema,
|
type TSubscribePlanSchema,
|
||||||
} from '~/pages/form-subscriptions-plan'
|
} from '~/pages/form-subscriptions-plan'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.subscribe-plan.create'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import {
|
|||||||
type TSubscribePlanSchema,
|
type TSubscribePlanSchema,
|
||||||
} from '~/pages/form-subscriptions-plan'
|
} from '~/pages/form-subscriptions-plan'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.subscribe-plan.update'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { createTagsRequest } from '~/apis/admin/create-tags'
|
|||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { tagSchema, type TTagSchema } from '~/pages/form-tag'
|
import { tagSchema, type TTagSchema } from '~/pages/form-tag'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.tags.create'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { updateTagRequest } from '~/apis/admin/update-tag'
|
|||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
import { tagSchema, type TTagSchema } from '~/pages/form-tag'
|
import { tagSchema, type TTagSchema } from '~/pages/form-tag'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.tags.update'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|||||||
@ -7,10 +7,11 @@ import { uploadFileRequest } from '~/apis/admin/upload-file'
|
|||||||
import { uploadSchema, type TUploadSchema } from '~/layouts/admin/dialog-upload'
|
import { uploadSchema, type TUploadSchema } from '~/layouts/admin/dialog-upload'
|
||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.admin.upload'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { staffToken } = await handleCookie(request)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
errors,
|
errors,
|
||||||
@ -10,7 +10,7 @@ import {
|
|||||||
} from '~/layouts/news/form-subscription'
|
} from '~/layouts/news/form-subscription'
|
||||||
import { handleCookie } from '~/libs/cookies'
|
import { handleCookie } from '~/libs/cookies'
|
||||||
|
|
||||||
import type { Route } from './+types/actions.register'
|
import type { Route } from './+types/actions.subscribe'
|
||||||
|
|
||||||
export const action = async ({ request }: Route.ActionArgs) => {
|
export const action = async ({ request }: Route.ActionArgs) => {
|
||||||
const { userToken } = await handleCookie(request)
|
const { userToken } = await handleCookie(request)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user