feat: Oauth update
This commit is contained in:
@@ -21,4 +21,3 @@ export const oauthLogin = (type: string) => {
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
|
@@ -27,7 +27,7 @@ const Resources = () => {
|
||||
</div>
|
||||
<div className={style.tabInfoContainer}>
|
||||
{tabsContent[activeTab].cards.map((card: any) => {
|
||||
return <TabCard key={card.key} {...card} />;
|
||||
return <TabCard key={card.key} title={card.title} icon={card.icon} />;
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
|
@@ -5,6 +5,7 @@ import "./index.less";
|
||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||
import useStore from "@/utils/store/useStore.tsx";
|
||||
import { observer } from "mobx-react";
|
||||
import localforage from "localforage";
|
||||
|
||||
const LoadingPage = () => {
|
||||
const [search] = useSearchParams();
|
||||
@@ -14,6 +15,7 @@ const LoadingPage = () => {
|
||||
const store = useStore("user");
|
||||
store.setToken(token);
|
||||
store.setUserId(userId);
|
||||
localforage.setItem("token", token).then();
|
||||
useEffect(() => {
|
||||
document.body.classList.add("loading-body");
|
||||
if (store.getToken() !== null && store.getUserId() !== null) {
|
||||
|
@@ -1,9 +1,11 @@
|
||||
import { lazy } from 'react'
|
||||
/** @format */
|
||||
|
||||
import { lazy } from "react";
|
||||
|
||||
const login = lazy(
|
||||
() =>
|
||||
new Promise((resolve: any) => {
|
||||
setTimeout(() => resolve(import('@/views/User/Login')), 500)
|
||||
}),
|
||||
)
|
||||
export default login
|
||||
() =>
|
||||
new Promise((resolve: any) => {
|
||||
setTimeout(() => resolve(import("@/views/User/Login")), 500);
|
||||
}),
|
||||
);
|
||||
export default login;
|
||||
|
@@ -1,9 +1,12 @@
|
||||
/** @format */
|
||||
|
||||
import Request from "./request";
|
||||
import { handleLocalforage } from "@/utils/localforage";
|
||||
import localforage from "localforage";
|
||||
|
||||
const token = handleLocalforage.getItem("token").then();
|
||||
async function getToken() {
|
||||
return await localforage.getItem("token");
|
||||
}
|
||||
const token = await getToken();
|
||||
const web: Request = new Request({
|
||||
baseURL: import.meta.env.VITE_APP_BASE_API,
|
||||
headers: {
|
||||
|
@@ -1,11 +1,12 @@
|
||||
/** @format */
|
||||
|
||||
import MainContainer from "@/components/Home/main-container/MainContainer.tsx";
|
||||
import { observer } from "mobx-react";
|
||||
|
||||
export default () => {
|
||||
export default observer(() => {
|
||||
return (
|
||||
<div>
|
||||
<MainContainer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
@@ -56,6 +56,7 @@ export default observer(() => {
|
||||
|
||||
async function oAuthLogin(type: string) {
|
||||
const res: any = await oauthLogin(type);
|
||||
console.log(res);
|
||||
window.location.href = res.data;
|
||||
}
|
||||
|
||||
|
@@ -1,44 +1,45 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": true,
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": [
|
||||
"ES2020",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
],
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.tsx",
|
||||
"types/*.d.ts",
|
||||
"vite.config.ts",
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
}
|
||||
]
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": true,
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": [
|
||||
"ES2020",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "react-jsx",
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.tsx",
|
||||
"types/*.d.ts",
|
||||
"vite.config.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user