mirror of https://gitee.com/answerdev/answer.git
fix(search): complete href for SearchItem answer
This commit is contained in:
parent
1590b662f6
commit
aeb60ffa38
|
@ -334,6 +334,7 @@ export interface SearchResItem {
|
|||
object_type: string;
|
||||
object: {
|
||||
id: string;
|
||||
question_id?: string;
|
||||
title: string;
|
||||
excerpt: string;
|
||||
created_at: number;
|
||||
|
|
|
@ -14,6 +14,10 @@ const Index: FC<Props> = ({ data }) => {
|
|||
if (!data?.object_type) {
|
||||
return null;
|
||||
}
|
||||
let itemUrl = `/questions/${data.object.id}`;
|
||||
if (data.object_type === 'answer') {
|
||||
itemUrl = `/questions/${data.object.question_id}/${data.object.id}`;
|
||||
}
|
||||
return (
|
||||
<ListGroupItem className="py-3 px-0">
|
||||
<div className="mb-2 clearfix">
|
||||
|
@ -23,9 +27,7 @@ const Index: FC<Props> = ({ data }) => {
|
|||
style={{ marginTop: '2px' }}>
|
||||
{data.object_type === 'question' ? 'Q' : 'A'}
|
||||
</Badge>
|
||||
<a
|
||||
className="h5 mb-0 link-dark text-break"
|
||||
href={`/questions/${data.object.id}`}>
|
||||
<a className="h5 mb-0 link-dark text-break" href={itemUrl}>
|
||||
{data.object.title}
|
||||
{data.object.status === 'closed'
|
||||
? ` [${t('closed', { keyPrefix: 'question' })}]`
|
||||
|
|
Loading…
Reference in New Issue