Skip to content

Commit

Permalink
refactor: 增加登录配置
Browse files Browse the repository at this point in the history
  • Loading branch information
Win102021DMMRWQ\Administrator committed Sep 1, 2023
1 parent 5c56166 commit df56b41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/editor/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ VITE_HOST=http://127.0.0.1:3840
VITE_AUTH_URL=http://localhost:5173/authorized
VITE_GITHUB_CLIENT_ID=2508f0ed8dca4587f1be
VITE_GITEE_CLIENT_ID=c9800127805e222c24c132eeca6a0ec659a518f998199cb064d7cded578e0bb8
VITE_TOKEN=
VITE_TOKEN=
VITE_NO_LOGIN=true
4 changes: 2 additions & 2 deletions packages/editor/src/router/AuthorizedRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Outlet, useNavigate } from "react-router-dom";
import { useEffect, useState } from "react";
import { useGlobalStore } from "@/store";

const { VITE_TOKEN, MODE } = import.meta.env;
const { VITE_TOKEN, VITE_NO_LOGIN } = import.meta.env;

export default function AuthorizedRoot() {
const { userStore } = useGlobalStore();
Expand All @@ -13,7 +13,7 @@ export default function AuthorizedRoot() {
if (token) {
userStore.userRefresh();
} else {
if (MODE === "development") {
if (VITE_NO_LOGIN) {
userStore.userAuth("123456", "local").then(res =>{
if(res){
window.location.reload()
Expand Down

0 comments on commit df56b41

Please sign in to comment.