feat(mode): add demo mode (#1121)

* feat(mode): add demo mode

* chroe: Update store/db/db.go

Co-authored-by: boojack <stevenlgtm@gmail.com>

* chroe: Update store/db/db.go

Co-authored-by: boojack <stevenlgtm@gmail.com>

---------

Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
Yoshino-s
2023-02-19 13:36:45 +08:00
committed by GitHub
parent d0b8b076cf
commit afaaec8492
9 changed files with 27 additions and 23 deletions

View File

@@ -26,8 +26,8 @@ const Auth = () => {
const actionBtnLoadingState = useLoading(false);
const { appearance, locale, systemStatus } = globalStore.state;
const mode = systemStatus.profile.mode;
const [username, setUsername] = useState(mode === "dev" ? "demohero" : "");
const [password, setPassword] = useState(mode === "dev" ? "secret" : "");
const [username, setUsername] = useState(mode === "demo" ? "demohero" : "");
const [password, setPassword] = useState(mode === "demo" ? "secret" : "");
const [identityProviderList, setIdentityProviderList] = useState<IdentityProvider[]>([]);
useEffect(() => {

View File

@@ -65,7 +65,7 @@ export const useGlobalStore = () => {
return store.getState().global;
},
isDev: () => {
return state.systemStatus.profile.mode === "dev";
return state.systemStatus.profile.mode !== "prod";
},
fetchSystemStatus: async () => {
const { data: systemStatus } = (await api.getSystemStatus()).data;

View File

@@ -14,7 +14,7 @@ const globalSlice = createSlice({
systemStatus: {
host: undefined,
profile: {
mode: "dev",
mode: "demo",
version: "",
},
dbSize: 0,