refactor: remove accessToken from parameters in API requests for cleaner handling
This commit is contained in:
parent
9976626f97
commit
bad5294030
@ -1,6 +1,6 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
import { HttpServer } from '~/libs/http-server'
|
||||
import { HttpServer, type THttpServer } from '~/libs/http-server'
|
||||
import type { TCategorySchema } from '~/pages/form-category'
|
||||
|
||||
const categoryResponseSchema = z.object({
|
||||
@ -10,9 +10,8 @@ const categoryResponseSchema = z.object({
|
||||
})
|
||||
|
||||
type TParameters = {
|
||||
accessToken: string
|
||||
payload: TCategorySchema
|
||||
}
|
||||
} & THttpServer
|
||||
|
||||
export const createCategoryRequest = async (parameters: TParameters) => {
|
||||
const { payload, ...restParameters } = parameters
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
import { HttpServer } from '~/libs/http-server'
|
||||
import { HttpServer, type THttpServer } from '~/libs/http-server'
|
||||
import type { TContentSchema } from '~/pages/form-contents'
|
||||
|
||||
const newsResponseSchema = z.object({
|
||||
@ -10,9 +10,8 @@ const newsResponseSchema = z.object({
|
||||
})
|
||||
|
||||
type TParameter = {
|
||||
accessToken: string
|
||||
payload: TContentSchema
|
||||
}
|
||||
} & THttpServer
|
||||
|
||||
export const createNewsRequest = async (parameters: TParameter) => {
|
||||
const { payload, ...restParameters } = parameters
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
import { HttpServer } from '~/libs/http-server'
|
||||
import { HttpServer, type THttpServer } from '~/libs/http-server'
|
||||
import type { TTagSchema } from '~/pages/form-tag'
|
||||
|
||||
const tagsResponseSchema = z.object({
|
||||
@ -10,9 +10,8 @@ const tagsResponseSchema = z.object({
|
||||
})
|
||||
|
||||
type TParameters = {
|
||||
accessToken: string
|
||||
payload: TTagSchema
|
||||
}
|
||||
} & THttpServer
|
||||
|
||||
export const createTagsRequest = async (parameters: TParameters) => {
|
||||
const { payload, ...restParameters } = parameters
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
import { HttpServer } from '~/libs/http-server'
|
||||
import { HttpServer, type THttpServer } from '~/libs/http-server'
|
||||
import type { TCategorySchema } from '~/pages/form-category'
|
||||
|
||||
const categoryResponseSchema = z.object({
|
||||
@ -10,9 +10,8 @@ const categoryResponseSchema = z.object({
|
||||
})
|
||||
|
||||
type TParameters = {
|
||||
accessToken: string
|
||||
payload: TCategorySchema
|
||||
}
|
||||
} & THttpServer
|
||||
|
||||
export const updateCategoryRequest = async (parameters: TParameters) => {
|
||||
const { payload, ...restParameters } = parameters
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
import { HttpServer } from '~/libs/http-server'
|
||||
import { HttpServer, type THttpServer } from '~/libs/http-server'
|
||||
import type { TContentSchema } from '~/pages/form-contents'
|
||||
|
||||
const newsResponseSchema = z.object({
|
||||
@ -10,9 +10,8 @@ const newsResponseSchema = z.object({
|
||||
})
|
||||
|
||||
type TParameter = {
|
||||
accessToken: string
|
||||
payload: TContentSchema
|
||||
}
|
||||
} & THttpServer
|
||||
|
||||
export const updateNewsRequest = async (parameters: TParameter) => {
|
||||
const { payload, ...restParameters } = parameters
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
import { HttpServer } from '~/libs/http-server'
|
||||
import { HttpServer, type THttpServer } from '~/libs/http-server'
|
||||
import type { TTagSchema } from '~/pages/form-tag'
|
||||
|
||||
const tagResponseSchema = z.object({
|
||||
@ -10,9 +10,8 @@ const tagResponseSchema = z.object({
|
||||
})
|
||||
|
||||
type TParameters = {
|
||||
accessToken: string
|
||||
payload: TTagSchema
|
||||
}
|
||||
} & THttpServer
|
||||
|
||||
export const updateTagRequest = async (parameters: TParameters) => {
|
||||
const { payload, ...restParameters } = parameters
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user