Merge pull request #240 from answerdev/feat/1.0.6/ui

Feat/1.0.6/UI
This commit is contained in:
dashuai
2023-03-06 12:22:15 +08:00
committed by GitHub
+17
View File
@@ -56,6 +56,7 @@ const Index = () => {
const { setUsers } = usePageUsers();
const userInfo = loggedUserInfoStore((state) => state.user);
const isAuthor = userInfo?.username === question?.user_info?.username;
const isAdmin = userInfo?.is_admin;
const isLogged = Boolean(userInfo?.access_token);
const { state: locationState } = useLocation();
@@ -76,6 +77,22 @@ const Index = () => {
page_size: 999,
});
if (res) {
res.list = res.list?.filter((v) => {
// delete answers pnly show to author and admin and has searchparams aid
if (v.status === 10) {
if (
(v?.user_info.username === userInfo?.username || isAdmin) &&
aid === v.id
) {
return v;
}
return null;
}
return v;
});
console.log(res);
setAnswers(res);
if (page > 0 || order) {
// scroll into view;