forked from Gitlink/forgeplus-react
启智竞赛无权限编辑时跳转到403
This commit is contained in:
parent
f4a67ee68e
commit
97e8547c94
|
@ -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});
|
||||
|
|
|
@ -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=>{
|
||||
|
|
Loading…
Reference in New Issue