From 1d97ff88b9d124a72c9da13cdd4ea5a2e3ddc66f Mon Sep 17 00:00:00 2001 From: xion Date: Sun, 23 Mar 2025 02:59:41 +0800 Subject: [PATCH] feat: add app and config --- packages/components/src/index.tsx | 7 +- packages/components/src/input/TextField.tsx | 23 +++++ packages/components/src/select/TagsInput.tsx | 17 +++- packages/components/src/theme/index.tsx | 35 +++++-- packages/resources/src/index.ts | 4 +- .../pages/file/draw/modules/DatePicker.tsx | 4 +- .../src/pages/file/draw/modules/MetaForm.tsx | 24 +---- .../pages/file/draw/modules/SelectPicker.tsx | 30 ------ .../pages/file/modules/PermissionManager.tsx | 62 +++++------- .../pages/file/modules/PermissionModal.tsx | 63 ++++++++++++ public/locales/en/translation.json | 25 ++++- public/locales/zh/translation.json | 25 ++++- src/App.tsx | 1 + src/modules/layout/LayoutUser.tsx | 27 +++--- src/modules/layout/Menu.tsx | 12 ++- src/modules/layout/index.tsx | 32 ++++-- src/modules/query.ts | 9 -- src/pages/app/edit/List.tsx | 8 +- src/pages/config/edit/List.tsx | 97 ++++++++++++++----- src/pages/config/store/config.ts | 2 +- src/pages/container/edit/List.tsx | 2 +- src/pages/org/edit/UserList.tsx | 1 - submodules/query-login | 2 +- vite.config.ts | 15 +-- 24 files changed, 351 insertions(+), 176 deletions(-) create mode 100644 packages/components/src/input/TextField.tsx delete mode 100644 packages/resources/src/pages/file/draw/modules/SelectPicker.tsx create mode 100644 packages/resources/src/pages/file/modules/PermissionModal.tsx diff --git a/packages/components/src/index.tsx b/packages/components/src/index.tsx index abd5fa0..4989af8 100644 --- a/packages/components/src/index.tsx +++ b/packages/components/src/index.tsx @@ -1 +1,6 @@ -export * from './theme'; \ No newline at end of file +export * from './theme'; + +/** + * 输入组件, 使用theme的defaultProps + */ +export * from './input/TextField'; diff --git a/packages/components/src/input/TextField.tsx b/packages/components/src/input/TextField.tsx new file mode 100644 index 0000000..e2c946e --- /dev/null +++ b/packages/components/src/input/TextField.tsx @@ -0,0 +1,23 @@ +import { TextField as MuiTextField, TextFieldProps, Tooltip } from '@mui/material'; +import { useTheme } from '../theme'; +import { HelpCircle } from 'lucide-react'; + +export const TextField = (props: TextFieldProps) => { + const theme = useTheme(); + const defaultProps = theme.components?.MuiTextField?.defaultProps; + return ; +}; + +export const TextFieldLabel = ({ children, tips, label }: { children?: React.ReactNode; tips?: string; label?: any }) => { + return ( +
+ {label} + {children} + {tips && ( + + + + )} +
+ ); +}; diff --git a/packages/components/src/select/TagsInput.tsx b/packages/components/src/select/TagsInput.tsx index ad39f95..3151116 100644 --- a/packages/components/src/select/TagsInput.tsx +++ b/packages/components/src/select/TagsInput.tsx @@ -6,9 +6,10 @@ type TagsInputProps = { value: string[]; onChange: (value: string[]) => void; placeholder?: string; - label?: string; + label?: any; + showLabel?: boolean; }; -export const TagsInput = ({ value, onChange, placeholder = 'Add a tag', label = 'Tags' }: TagsInputProps) => { +export const TagsInput = ({ value, onChange, placeholder = '', label = '', showLabel = false }: TagsInputProps) => { const [tags, setTags] = useState(value); useEffect(() => { setTags(value); @@ -26,6 +27,9 @@ export const TagsInput = ({ value, onChange, placeholder = 'Add a tag', label = // setTags(newValue as string[]); onChange(newValue as string[]); }} + sx={{ + width: '100%', + }} renderTags={(value: string[], getTagProps) => { const id = randomid(); const com = value.map((option: string, index: number) => ( @@ -33,6 +37,13 @@ export const TagsInput = ({ value, onChange, placeholder = 'Add a tag', label = variant='outlined' sx={{ borderColor: 'primary.main', + borderRadius: '4px', + '&:hover': { + borderColor: 'primary.main', + }, + '& .MuiChip-deleteIcon': { + color: 'secondary.main', + }, }} label={option} {...getTagProps({ index })} @@ -41,7 +52,7 @@ export const TagsInput = ({ value, onChange, placeholder = 'Add a tag', label = )); return {com}; }} - renderInput={(params) => } + renderInput={(params) => } /> ); }; diff --git a/packages/components/src/theme/index.tsx b/packages/components/src/theme/index.tsx index 904c7af..bea6af9 100644 --- a/packages/components/src/theme/index.tsx +++ b/packages/components/src/theme/index.tsx @@ -35,19 +35,21 @@ const generateShadows = (color: string): Shadows => { `0px 13px 17px -8px ${color}`, ]; }; +const primaryMain = amber[300]; // #ffc107 +const secondaryMain = amber[500]; // #ffa000 export const themeOptions: ThemeOptions = { // @ts-ignore // cssVariables: true, palette: { primary: { - main: '#ffc107', // amber[300] + main: primaryMain, // amber[300] }, secondary: { - main: '#ffa000', // amber[500] + main: secondaryMain, // amber[500] }, divider: amber[200], common: { - white: '#ffa000', + white: secondaryMain, }, text: { primary: amber[600], @@ -78,7 +80,7 @@ export const themeOptions: ThemeOptions = { '&.MuiButton-contained': { color: '#ffffff', ':hover': { - color: amber[500], + color: secondaryMain, }, }, }, @@ -96,6 +98,7 @@ export const themeOptions: ThemeOptions = { MuiTextField: { defaultProps: { fullWidth: true, + size: 'small', slotProps: { inputLabel: { shrink: true, @@ -121,6 +124,11 @@ export const themeOptions: ThemeOptions = { }, }, }, + MuiAutocomplete: { + defaultProps: { + size: 'small', + }, + }, MuiSelect: { styleOverrides: { root: { @@ -156,7 +164,10 @@ export const themeOptions: ThemeOptions = { MuiFormControlLabel: { defaultProps: { labelPlacement: 'top', - sx: { + }, + styleOverrides: { + root: { + color: amber[600], alignItems: 'flex-start', '& .MuiFormControlLabel-label': { textAlign: 'left', @@ -170,9 +181,18 @@ export const themeOptions: ThemeOptions = { }, }, }, + }, + MuiMenuItem: { styleOverrides: { root: { - color: amber[600], + '&.Mui-selected': { + backgroundColor: amber[500], + color: '#ffffff', + '&:hover': { + backgroundColor: amber[600], + color: '#ffffff', + }, + }, }, }, }, @@ -201,3 +221,6 @@ export const CustomThemeProvider = ({ children, themeOptions: customThemeOptions const theme = createTheme(customThemeOptions || themeOptions); return {children}; }; + +// TODO: think +export const getComponentProps = () => {}; diff --git a/packages/resources/src/index.ts b/packages/resources/src/index.ts index 7b7f951..1198a49 100644 --- a/packages/resources/src/index.ts +++ b/packages/resources/src/index.ts @@ -1,3 +1,5 @@ export { KeyParse, keysTips } from './pages/file/modules/key-parse'; +export { PermissionManager } from './pages/file/modules/PermissionManager.tsx'; +export { PermissionModal, usePermissionModal } from './pages/file/modules/PermissionModal.tsx'; export { iText } from './i-text/index.ts'; -export * from './pages/upload/app'; \ No newline at end of file +export * from './pages/upload/app'; diff --git a/packages/resources/src/pages/file/draw/modules/DatePicker.tsx b/packages/resources/src/pages/file/draw/modules/DatePicker.tsx index 131479c..aa6874b 100644 --- a/packages/resources/src/pages/file/draw/modules/DatePicker.tsx +++ b/packages/resources/src/pages/file/draw/modules/DatePicker.tsx @@ -1,6 +1,7 @@ import ReactDatePicker from 'antd/es/date-picker'; import { styled, useTheme } from '@mui/material'; import 'antd/es/date-picker/style/index'; +import { useTranslation } from 'react-i18next'; interface DatePickerProps { value?: Date | null; onChange?: (date: Date | null) => void; @@ -8,13 +9,14 @@ interface DatePickerProps { } export const DatePickerCom = ({ value, onChange, className }: DatePickerProps) => { + const { t } = useTranslation(); const theme = useTheme(); const primaryColor = theme.palette.primary.main; return (
{ const keys = ['password', 'usernames', 'expiration-time']; const deleteKeys = keys.map((item) => { @@ -187,7 +187,7 @@ export const MetaForm = () => {
-
+ {keys.map((key) => { let control: React.ReactNode | null = null; if (key === 'share') { @@ -195,7 +195,7 @@ export const MetaForm = () => { } else if (key === 'expiration-time') { control = handleFormDataChange(key, date)} />; } else if (key === 'usernames') { - control = handleFormDataChange(key, value)} />; + control = handleFormDataChange(key, value)} />; } else { control = handleFormDataChange(key, value)} />; } @@ -226,23 +226,7 @@ export const MetaForm = () => { ); }; - return ( -
- } - labelPlacement='top' - control={control} - sx={{ - alignItems: 'flex-start', - '& .MuiFormControlLabel-label': { - textAlign: 'left', - width: '100%', - }, - }} - /> -
- ); + return } control={control} />; })} diff --git a/packages/resources/src/pages/file/draw/modules/SelectPicker.tsx b/packages/resources/src/pages/file/draw/modules/SelectPicker.tsx deleted file mode 100644 index 953a1ae..0000000 --- a/packages/resources/src/pages/file/draw/modules/SelectPicker.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { styled } from '@mui/material'; -import Select from 'antd/es/select'; -import 'antd/es/select/style/index'; - -interface SelectPickerProps { - value: string[]; - onChange: (value: string[]) => void; - className?: string; -} - -export const SelectPickerCom = ({ value, onChange, className }: SelectPickerProps) => { - return - - 公开 + + {t('Public')} - - 受保护 + + {t('Protected')} - - 私有 + + {t('Private')} ); @@ -85,8 +86,9 @@ export const PermissionManager = ({ value, onChange, className }: PermissionMana }; const tips = getTips('share', i18n.language); return ( -
+ onChangeValue('share', value)} />} label={
@@ -99,38 +101,26 @@ export const PermissionManager = ({ value, onChange, className }: PermissionMana /> {keys.map((item: any) => { let control: React.ReactNode | null = null; + const tips = getTips(item); + + const label = ( +
+ {t(item)} + {tips && ( + + + + )} +
+ ); if (item === 'expiration-time') { - control = onChangeValue(item, date)} />; + control = onChangeValue(item, date)} />; } else if (item === 'usernames') { - control = onChangeValue(item, value)} />; + control = onChangeValue(item, value)} />; } else { control = onChangeValue(item, value)} />; } - const tips = getTips(item); - return ( - - {item} - {tips && ( - - - - )} -
- } - sx={{ - alignItems: 'flex-start', - '& .MuiFormControlLabel-label': { - textAlign: 'left', - width: '100%', - }, - }} - /> - ); + return ; })} ); diff --git a/packages/resources/src/pages/file/modules/PermissionModal.tsx b/packages/resources/src/pages/file/modules/PermissionModal.tsx new file mode 100644 index 0000000..b03eff8 --- /dev/null +++ b/packages/resources/src/pages/file/modules/PermissionModal.tsx @@ -0,0 +1,63 @@ +import { Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@mui/material'; +import { useTranslation } from 'react-i18next'; +import { PermissionManager } from './PermissionManager'; +import { useEffect, useState } from 'react'; + +type PermissionModalProps = { + open: boolean; + onClose: () => void; + value: Record; + onChange: (value: Record) => void; + onSave: () => void; +}; +export const PermissionModal = ({ open, onClose, value, onChange, onSave }: PermissionModalProps) => { + const { t } = useTranslation(); + return ( + + {t('app.share')} + + + + + + + + + ); +}; + +type UsePermissionModalProps = { + /** + * 保存回调 + */ + onSave: (values: Record) => Promise; +}; +export const usePermissionModal = ({ onSave }: UsePermissionModalProps) => { + const [open, setOpen] = useState(false); + const [formData, setFormData] = useState>({}); + const onChange = (value: Record) => { + setFormData(value); + }; + const _onSave = async () => { + const res = await onSave(formData); + if (res) { + setOpen(false); + } + }; + const contextHolder = setOpen(false)} value={formData} onChange={onChange} onSave={_onSave} />; + return { + open, + setOpen: (open: boolean, fromData?: any) => { + setOpen(open); + if (open) { + setFormData(fromData ?? {}); + } + }, + setFormData: (values: any) => { + setFormData({ ...formData, ...values }); + }, + contextHolder, + }; +}; diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 9c1af99..695fb76 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -47,7 +47,28 @@ "app": { "domain": "Domain", "version": "Version", - "runtime": "Can run environment" + "runtime": "Can run environment", + "share": "Share Config" }, - "Share": "Share" + "Share": "Share", + "Switch To User": "Switch To User", + "Language changed to": "Language changed to", + "en": "English", + "zh": "Chinese", + "Config": "Config", + "Tags": "Tags", + "Add a tag": "Add a tag", + "Tags Input": "Tags Input", + "Public": "Public", + "Protected": "Protected", + "Private": "Private", + "Input User Name": "Input User Name", + "Select Date": "Select Date", + "Permission": "Permission Manager", + "password": "Password", + "expiration-time": "Expiration Time", + "usernames": "Usernames", + "content-type": "Content Type", + "app-source": "App Source", + "app-version": "App Version" } \ No newline at end of file diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 3d61489..52df8ae 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -47,7 +47,28 @@ "app": { "domain": "访问域名", "version": "版本", - "runtime": "可以运行的环境" + "runtime": "可以运行的环境", + "share": "共享配置" }, - "Share": "分享" + "Share": "分享", + "Switch To User": "切换到用户", + "Language changed to": "语言已切换到", + "en": "英语", + "zh": "中文", + "Config": "配置", + "Tags": "标签", + "Add a tag": "添加一个标签", + "Tags Input": "标签输入", + "Public": "公开", + "Protected": "受保护", + "Private": "私有", + "Input User Name": "输入用户名称", + "Select Date": "选择日期", + "Permission": "权限管理", + "password": "密码", + "expiration-time": "过期时间", + "usernames": "用户名", + "content-type": "内容类型", + "app-source": "应用来源", + "app-version": "应用版本" } \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 6e03ca5..741b8ed 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -85,6 +85,7 @@ export const App = () => { +
diff --git a/src/modules/layout/LayoutUser.tsx b/src/modules/layout/LayoutUser.tsx index 66ccc89..1a38972 100644 --- a/src/modules/layout/LayoutUser.tsx +++ b/src/modules/layout/LayoutUser.tsx @@ -3,13 +3,13 @@ import { useLayoutStore } from './store'; import clsx from 'clsx'; import { Menu, MenuItem, Tooltip } from '@mui/material'; import { Button } from '@mui/material'; -import { IconButton } from '@kevisual/center-components/button/index.tsx'; import { message } from '@/modules/message'; -import { DashboardOutlined, HomeOutlined, LogoutOutlined, SmileOutlined } from '@ant-design/icons'; +import SmileOutlined from '@ant-design/icons/SmileOutlined'; +import SwitcherOutlined from '@ant-design/icons/SwitcherOutlined'; import { useMemo } from 'react'; -import { query } from '../query'; +import { query, queryLogin } from '../query'; import { useNewNavigate } from '../navicate'; -import { Users, X } from 'lucide-react'; +import { LogOut, Map, SquareUser, Users, X } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import React from 'react'; @@ -27,17 +27,17 @@ export const LayoutUser = () => { const meun = [ { title: t('Your profile'), - icon: , + icon: , link: '/user/profile', }, { title: t('Your orgs'), - icon: , + icon: , link: '/org/edit/list', }, { title: t('Site Map'), - icon: , + icon: , link: '/map', }, ]; @@ -110,12 +110,17 @@ export const LayoutUser = () => {
{ - query.removeToken(); - window.open('/user/login', '_self'); + onClick={async () => { + const res = await queryLogin.logout(); + // console.log(res); + if (res.success) { + window.open('/user/login', '_self'); + } else { + message.error(res.message || 'Logout failed'); + } }}>
- +
{t('Login Out')}
diff --git a/src/modules/layout/Menu.tsx b/src/modules/layout/Menu.tsx index 8e4d6c8..5c3cd09 100644 --- a/src/modules/layout/Menu.tsx +++ b/src/modules/layout/Menu.tsx @@ -3,8 +3,13 @@ import { useLayoutStore } from './store'; import clsx from 'clsx'; import { Button } from '@mui/material'; import { message } from '@/modules/message'; -import { AppstoreOutlined, CodeOutlined, FolderOutlined, HomeOutlined, SmileOutlined, SwitcherOutlined } from '@ant-design/icons'; -import { X } from 'lucide-react'; +import HomeOutlined from '@ant-design/icons/HomeOutlined'; +import AppstoreOutlined from '@ant-design/icons/AppstoreOutlined'; +import FolderOutlined from '@ant-design/icons/FolderOutlined'; +import CodeOutlined from '@ant-design/icons/CodeOutlined'; +import SwitcherOutlined from '@ant-design/icons/SwitcherOutlined'; +import SmileOutlined from '@ant-design/icons/SmileOutlined'; +import { X, Settings } from 'lucide-react'; import { useNewNavigate } from '../navicate'; import { useTranslation } from 'react-i18next'; @@ -36,6 +41,7 @@ export const LayoutMenu = () => { icon: , link: '/org/edit/list', }, + { title: t('Config'), icon: , link: '/config/edit/list' }, { title: t('About'), icon: , @@ -72,7 +78,7 @@ export const LayoutMenu = () => { } setOpen(false); }}> -
{item.icon}
+
{item.icon}
{item.title}
); diff --git a/src/modules/layout/index.tsx b/src/modules/layout/index.tsx index aa62f0e..129b7eb 100644 --- a/src/modules/layout/index.tsx +++ b/src/modules/layout/index.tsx @@ -14,6 +14,8 @@ import i18n from 'i18next'; import { IconButton } from '@kevisual/center-components/button/index.tsx'; import { Languages } from 'lucide-react'; +import { useTranslation } from 'react-i18next'; +import { toast } from 'react-toastify'; type LayoutMainProps = { title?: React.ReactNode; @@ -64,10 +66,11 @@ export const LayoutMain = (props: LayoutMainProps) => { const changeLanguage = (lng: string) => { i18n.changeLanguage(lng); + toast.success(t('Language changed to') + ' ' + t(lng)); handleClose(); }; const currentLanguage = i18n.language; - + const { t } = useTranslation(); return (
@@ -89,10 +92,27 @@ export const LayoutMain = (props: LayoutMainProps) => {
- + - + changeLanguage('en')}> English @@ -103,13 +123,13 @@ export const LayoutMain = (props: LayoutMainProps) => {
{menuStore.me?.type === 'org' && (
- - +
)} diff --git a/src/modules/query.ts b/src/modules/query.ts index f7c295b..92f3afb 100644 --- a/src/modules/query.ts +++ b/src/modules/query.ts @@ -33,15 +33,6 @@ export const request = query.post; export const ws = query.qws?.ws; -// 当连接成功时 -// query.qws.ws.onopen = () => { -// console.log('Connected to WebSocket server'); -// }; - -// // 处理 WebSocket 关闭 -// query.qws.ws.onclose = () => { -// console.log('Disconnected from WebSocket server'); -// }; query.qws.listenConnect(() => { console.log('Connected to WebSocket server'); }); diff --git a/src/pages/app/edit/List.tsx b/src/pages/app/edit/List.tsx index 142cd8b..058a6cc 100644 --- a/src/pages/app/edit/List.tsx +++ b/src/pages/app/edit/List.tsx @@ -167,7 +167,7 @@ const ShareModal = () => { onClose={() => { containerStore.setShowEdit(false); }}> - {iText.share.title} + {t('app.share')}
{ /> Promise; type?: 'yaml' | 'json'; @@ -42,7 +46,6 @@ export const DataYamlEdit = ({ onSave, type }: DataYamlEditProps) => { } } }, [formData]); - console.log(formData); const handleSave = () => { let data: any = {}; try { @@ -109,14 +112,16 @@ export const DrawerEdit = () => { await updateData({ ...values, id: formData.id }, { refresh: true }); }; const onSubmit = (data) => { - console.log('Form Data:', data); const pickValue = pick(data, ['title', 'key', 'description']); onSave(pickValue); }; + const theme = useTheme(); + const defaultProps = theme.components?.MuiTextField?.defaultProps; return ( { {tab === 'base' && ( -
- } - /> + + } /> } - /> - } + render={({ field }) => ( + + } + /> + )} /> + } /> @@ -174,14 +178,36 @@ export const DrawerEdit = () => { ); }; - +export const MyController = React.forwardRef( + ({ control, name, Component, componentProps }: { control: any; name: string; Component: (props: any) => JSX.Element; componentProps: any }, ref) => { + const theme = useTheme(); + const defaultProps = theme.components?.MuiTextField?.defaultProps; + console.log(defaultProps, 'defaultProps'); + const { field } = useController({ control, name }); + return ; + }, +); export const List = () => { - const { list, getConfig, setShowEdit, setFormData, deleteConfig } = useConfigStore(); + const { list, getConfig, setShowEdit, setFormData, deleteConfig, updateData, formData } = useConfigStore(); const [modal, contextHolder] = useModal(); useEffect(() => { getConfig(); }, []); + const { setOpen, contextHolder: contextHolderPermission } = usePermissionModal({ + onSave: async (values) => { + const permission = values; + console.log(permission, formData.id); + if (permission && formData.id) { + const res = await updateData({ data: { permission }, id: formData.id }, { refresh: true }); + console.log(res); + return res.code === 200; + } + await new Promise((resolve) => setTimeout(resolve, 1000)); + return true; + }, + }); console.log(list); + const { t } = useTranslation(); return (
@@ -191,17 +217,26 @@ export const List = () => { setShowEdit(true); setFormData({}); }}> - +
-
+
-
+
{list.map((item) => ( -
+
{item.title}
-
{item.description}
+
+
+
{t('Description')}:
+
{item.description}
+
+
+
{t('Key')}:
+
{item.key}
+
+
+ + +
{contextHolder} + {contextHolderPermission}
); }; diff --git a/src/pages/config/store/config.ts b/src/pages/config/store/config.ts index 6a0eee3..aca32c7 100644 --- a/src/pages/config/store/config.ts +++ b/src/pages/config/store/config.ts @@ -3,7 +3,7 @@ import { query } from '@/modules/query'; import { toast } from 'react-toastify'; import { QueryConfig } from '@kevisual/query-config'; -export const queryConfig = new QueryConfig({ query }); +export const queryConfig = new QueryConfig({ query: query as any }); interface ConfigStore { list: any[]; diff --git a/src/pages/container/edit/List.tsx b/src/pages/container/edit/List.tsx index 7663dd0..fe1321e 100644 --- a/src/pages/container/edit/List.tsx +++ b/src/pages/container/edit/List.tsx @@ -83,7 +83,7 @@ const FormModal = () => { control={control} defaultValue={[]} render={({ field }) => { - return field.onChange(value)} />; + return field.onChange(value)} />; }} /> {!isEdit && ( diff --git a/src/pages/org/edit/UserList.tsx b/src/pages/org/edit/UserList.tsx index 01ca01d..39d7728 100644 --- a/src/pages/org/edit/UserList.tsx +++ b/src/pages/org/edit/UserList.tsx @@ -16,7 +16,6 @@ import { useModal } from '@kevisual/center-components/modal/Confirm.tsx'; import { TextField } from '@mui/material'; import { Select } from '@kevisual/center-components/select/index.tsx'; import { useForm, Controller } from 'react-hook-form'; -import EditOutlined from '@ant-design/icons/EditOutlined'; const FormModal = () => { const { control, handleSubmit, reset } = useForm(); diff --git a/submodules/query-login b/submodules/query-login index 24f091a..9ba45c3 160000 --- a/submodules/query-login +++ b/submodules/query-login @@ -1 +1 @@ -Subproject commit 24f091ac792342ea295496cf8ff49f6c79ab47a6 +Subproject commit 9ba45c37c2d642e7ae0a0856a29ba3f3cd61d2c9 diff --git a/vite.config.ts b/vite.config.ts index d5b81c1..955018a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -32,13 +32,7 @@ if (true) { target: backend, changeOrigin: true, ws: true, - rewrite: (path: any) => path.replace(/^\/api/, '/api'), - }, - '/api/router': { - target: backendWss, - changeOrigin: true, - ws: true, - rewriteWsOrigin: true, + cookieDomainRewrite: 'localhost', rewrite: (path: any) => path.replace(/^\/api/, '/api'), }, '/user/login': { @@ -81,13 +75,6 @@ export default defineConfig({ changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '/api'), }, - '/api/router': { - target: 'wss://localhost:4005', - changeOrigin: true, - ws: true, - rewriteWsOrigin: true, - rewrite: (path) => path.replace(/^\/api/, '/api'), - }, ...proxy, }, },