mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-23 18:36:37 +08:00
fix: restore the set of StatusContext
This commit is contained in:
parent
ac64fd26ad
commit
5cb933a278
@ -1,6 +1,7 @@
|
||||
import React, { useContext, useEffect, useLayoutEffect, useMemo, useState } from 'react';
|
||||
import {Link, useNavigate} from 'react-router-dom';
|
||||
import {UserContext} from '../context/User';
|
||||
import { StatusContext } from '../context/Status';
|
||||
|
||||
import { API, getLogo, getSystemName, isAdmin, isMobile, showError, showSuccess } from '../helpers';
|
||||
import '../index.css';
|
||||
@ -24,6 +25,7 @@ import {Nav, Avatar, Dropdown, Layout} from '@douyinfe/semi-ui';
|
||||
|
||||
const SiderBar = () => {
|
||||
const [userState, userDispatch] = useContext(UserContext);
|
||||
const [statusState, statusDispatch] = useContext(StatusContext);
|
||||
const defaultIsCollapsed = isMobile() || localStorage.getItem('default_collapse_sidebar') === 'true';
|
||||
|
||||
let navigate = useNavigate();
|
||||
@ -118,7 +120,7 @@ const SiderBar = () => {
|
||||
const { success, data } = res.data;
|
||||
if (success) {
|
||||
localStorage.setItem('status', JSON.stringify(data));
|
||||
// statusDispatch({ type: 'set', payload: data });
|
||||
statusDispatch({ type: 'set', payload: data });
|
||||
localStorage.setItem('system_name', data.system_name);
|
||||
localStorage.setItem('logo', data.logo);
|
||||
localStorage.setItem('footer_html', data.footer_html);
|
||||
|
@ -5,7 +5,7 @@ import { StatusContext } from '../../context/Status';
|
||||
import { marked } from 'marked';
|
||||
|
||||
const Home = () => {
|
||||
const [statusState, statusDispatch] = useContext(StatusContext);
|
||||
const [statusState] = useContext(StatusContext);
|
||||
const [homePageContentLoaded, setHomePageContentLoaded] = useState(false);
|
||||
const [homePageContent, setHomePageContent] = useState('');
|
||||
|
||||
@ -66,8 +66,8 @@ const Home = () => {
|
||||
<Card
|
||||
title='系统信息'
|
||||
headerExtraContent={<span style={{ fontSize:'12px', color: 'var(--semi-color-text-1)'}}>系统信息总览</span>}>
|
||||
<p>名称:{statusState?.system_name}</p>
|
||||
<p>版本:{statusState?.version ? statusState?.version : "unknown"}</p>
|
||||
<p>名称:{statusState?.status?.system_name}</p>
|
||||
<p>版本:{statusState?.status?.version ? statusState?.status?.version : "unknown"}</p>
|
||||
<p>
|
||||
源码:
|
||||
<a
|
||||
@ -86,27 +86,19 @@ const Home = () => {
|
||||
headerExtraContent={<span style={{ fontSize:'12px', color: 'var(--semi-color-text-1)'}}>系统配置总览</span>}>
|
||||
<p>
|
||||
邮箱验证:
|
||||
{statusState?.email_verification === true
|
||||
? '已启用'
|
||||
: '未启用'}
|
||||
{statusState?.status?.email_verification === true ? '已启用': '未启用'}
|
||||
</p>
|
||||
<p>
|
||||
GitHub 身份验证:
|
||||
{statusState?.github_oauth === true
|
||||
? '已启用'
|
||||
: '未启用'}
|
||||
{statusState?.status?.github_oauth === true ? '已启用' : '未启用'}
|
||||
</p>
|
||||
<p>
|
||||
微信身份验证:
|
||||
{statusState?.wechat_login === true
|
||||
? '已启用'
|
||||
: '未启用'}
|
||||
{statusState?.status?.wechat_login === true ? '已启用' : '未启用'}
|
||||
</p>
|
||||
<p>
|
||||
Turnstile 用户校验:
|
||||
{statusState?.turnstile_check === true
|
||||
? '已启用'
|
||||
: '未启用'}
|
||||
{statusState?.status?.turnstile_check === true ? '已启用' : '未启用'}
|
||||
</p>
|
||||
</Card>
|
||||
</Col>
|
||||
|
Loading…
Reference in New Issue
Block a user