@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user