mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 06:20:24 +00:00
feat: handling query string alias
This commit is contained in:
parent
420e358e10
commit
40273c58ff
@ -39,6 +39,7 @@ const Search:NextPage<SearchProps> = ({ data, query }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const getServerSideProps = async(ctx: Context) => {
|
export const getServerSideProps = async(ctx: Context) => {
|
||||||
|
if(ctx.query.query && !ctx.query.q) ctx.query.q = ctx.query.query
|
||||||
if(!ctx.query?.q) {
|
if(!ctx.query?.q) {
|
||||||
ctx.res.statusCode = 301
|
ctx.res.statusCode = 301
|
||||||
ctx.res.setHeader('Location', '/')
|
ctx.res.setHeader('Location', '/')
|
||||||
@ -69,7 +70,8 @@ interface Context extends NextPageContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface URLQuery extends ParsedUrlQuery {
|
interface URLQuery extends ParsedUrlQuery {
|
||||||
q: string
|
q?: string
|
||||||
|
query?: string
|
||||||
page?: string
|
page?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user