From 0514f0e76892d43cf12958cb29b1cddd29cde260 Mon Sep 17 00:00:00 2001 From: powerfulyang Date: Thu, 2 Nov 2023 10:41:46 +0800 Subject: [PATCH] feat: update management system address --- src/components/NavBar/User/index.tsx | 3 ++- src/constant/Constant.ts | 3 +++ src/hooks/useUser.ts | 1 + src/pages/tools/index.tsx | 4 +++- src/pages/tools/swagger2code/index.tsx | 4 ++-- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/NavBar/User/index.tsx b/src/components/NavBar/User/index.tsx index 85b122a9..d29fc8dd 100644 --- a/src/components/NavBar/User/index.tsx +++ b/src/components/NavBar/User/index.tsx @@ -1,3 +1,4 @@ +import { loginUrl } from '@/constant/Constant'; import React, { useMemo } from 'react'; import classNames from 'classnames'; import { LazyImage } from '@/components/LazyImage'; @@ -7,7 +8,7 @@ import styles from './index.module.scss'; export const login = () => { const { href } = window.location; // 前往中央登录中心 - window.location.href = `https://powerfulyang.com/admin/user/login?redirect=${encodeURI(href)}`; + window.location.href = `${loginUrl}?redirect=${encodeURI(href)}`; }; export const NavBarUser = () => { diff --git a/src/constant/Constant.ts b/src/constant/Constant.ts index ebf24c0b..b2d170eb 100644 --- a/src/constant/Constant.ts +++ b/src/constant/Constant.ts @@ -7,3 +7,6 @@ export const MarkdownImageFromAssetManageAltConstant = 'source protected'; export const CDN_ORIGIN = JSON.parse(variables.CDN_ORIGIN) as string; export const generateCdnStaticUrl = (path: string) => `${CDN_ORIGIN}${path}`; + +export const management = 'https://admin.powerfulyang.com'; +export const loginUrl = `${management}/user/login`; diff --git a/src/hooks/useUser.ts b/src/hooks/useUser.ts index f1376410..08307b9f 100644 --- a/src/hooks/useUser.ts +++ b/src/hooks/useUser.ts @@ -14,6 +14,7 @@ export const useUser = (enabled: boolean = false) => { const u = await clientApi.queryCurrentUser(); return u.data; }, + keepPreviousData: true, retry: false, refetchOnWindowFocus: true, enabled, diff --git a/src/pages/tools/index.tsx b/src/pages/tools/index.tsx index c9ed6230..00022616 100644 --- a/src/pages/tools/index.tsx +++ b/src/pages/tools/index.tsx @@ -1,3 +1,4 @@ +import { management } from '@/constant/Constant'; import Link from 'next/link'; import type { HTMLAttributeAnchorTarget } from 'react'; import { Card, CardContent } from '@/components/ui/card'; @@ -80,7 +81,8 @@ const tools: ToolProps[] = [ name: 'Management', description: 'Management', icon: 'https://scrnli.com/static/media/convert.72f8549077f576625a23b196db551253.svg', - url: '/admin/user/list', + url: management, + target: '_blank', }, { name: 'URL Params Extractor', diff --git a/src/pages/tools/swagger2code/index.tsx b/src/pages/tools/swagger2code/index.tsx index c31cf3a1..d68fee90 100644 --- a/src/pages/tools/swagger2code/index.tsx +++ b/src/pages/tools/swagger2code/index.tsx @@ -31,7 +31,7 @@ type FormHookData = { const Swagger2code: LayoutFC = () => { const [search, setSearch] = useState(''); - const [url, setUrl] = useState('https://powerfulyang.com/api/swagger-json'); + const [url, setUrl] = useState('https://api.powerfulyang.com/api/swagger-json'); const { control, handleSubmit } = useForm({ defaultValues: { path: null, @@ -85,7 +85,7 @@ const Swagger2code: LayoutFC = () => {
{ setUrl(e.target.value);