启智竞赛无权限编辑时跳转到403

This commit is contained in:
谢思 2022-04-19 15:32:20 +08:00
parent f4a67ee68e
commit 97e8547c94
2 changed files with 14 additions and 2 deletions

View File

@ -9,11 +9,17 @@ import '../notice/index.scss';
import '../notice/detail.scss';
export default Form.create()((props) => {
const {form, history, match:{params:{type}}, qzDetail, setReloadDetail} = props;
const {form, history, match:{params:{type}}, qzDetail, setReloadDetail, current_user} = props;
const {getFieldDecorator, validateFields, setFieldsValue } = form;
const [description, setDescription] = useState(qzDetail && type === "introduce" ? (qzDetail && qzDetail.content) : type === "fingerpost" ? (qzDetail && qzDetail.guide) : (qzDetail && qzDetail.about_us));
const [errorMessage, setErrorMessage] = useState(undefined);
useEffect(() =>{
if(current_user && !current_user.admin){
window.location.href="/403";
}
}, [])
useEffect(()=>{
setDescription(qzDetail && type === "introduce" ? (qzDetail && qzDetail.content) : type === "fingerpost" ? (qzDetail && qzDetail.guide) : (qzDetail && qzDetail.about_us));
setFieldsValue({video_url: qzDetail && qzDetail.video_url});

View File

@ -11,11 +11,17 @@ import RenderHtml from "src/components/render-html";
const Option = Select.Option;
export default Form.create()((props) => {
const {form, history, match:{params:{noticeId,type}, params}} = props;
const {form, history, match:{params:{noticeId,type}}, current_user} = props;
const {getFieldDecorator, validateFields, setFieldsValue } = form;
const [description, setDescription] = useState(undefined);
const [errorMessage, setErrorMessage] = useState(undefined);
useEffect(() =>{
if(current_user && !current_user.admin){
window.location.href="/403";
}
}, [])
useEffect(() => {
if(noticeId && type === "edit"){
getNoticeDetail(noticeId).then(response=>{