mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 14:10:22 +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) => {
|
||||
if(ctx.query.query && !ctx.query.q) ctx.query.q = ctx.query.query
|
||||
if(!ctx.query?.q) {
|
||||
ctx.res.statusCode = 301
|
||||
ctx.res.setHeader('Location', '/')
|
||||
@ -69,7 +70,8 @@ interface Context extends NextPageContext {
|
||||
}
|
||||
|
||||
interface URLQuery extends ParsedUrlQuery {
|
||||
q: string
|
||||
q?: string
|
||||
query?: string
|
||||
page?: string
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user