From f1f0ae2839f95fa8040b1e2fe823f1f9e7c9f9e9 Mon Sep 17 00:00:00 2001
From: Archer <545436317@qq.com>
Date: Sat, 11 Jan 2025 17:16:17 +0800
Subject: [PATCH] fix: per;fix: invite user un refresh;perf: loginout (#3566)
* perf: loginout
* fix: invite user un refresh
* fix: per
* fix: dockerfile
* perf: docker file
---
.github/workflows/preview-fastgpt-image.yml | 17 ++++++++
projects/app/Dockerfile | 1 -
.../user/team/UpdateInviteModal/index.tsx | 41 +++++++++----------
projects/app/src/pages/account/team/index.tsx | 2 -
.../api/support/user/account/loginout.ts | 16 +++-----
5 files changed, 41 insertions(+), 36 deletions(-)
diff --git a/.github/workflows/preview-fastgpt-image.yml b/.github/workflows/preview-fastgpt-image.yml
index 9e5780112788..03d4263048ca 100644
--- a/.github/workflows/preview-fastgpt-image.yml
+++ b/.github/workflows/preview-fastgpt-image.yml
@@ -51,6 +51,23 @@ jobs:
--cache-to=type=local,dest=/tmp/.buildx-cache \
-t ${DOCKER_REPO_TAGGED} \
.
+ # Add write md step after build
+ - name: Write md
+ run: |
+ echo "# 🤖 Generated by deploy action" > report.md
+ echo "📦 Preview Image: \`${DOCKER_REPO_TAGGED}\`" >> report.md
+ cat report.md
+
+ - name: Gh Rebot for Sealos
+ uses: labring/gh-rebot@v0.0.6
+ if: ${{ (github.event_name == 'pull_request_target') }}
+ with:
+ version: v0.0.6
+ env:
+ GH_TOKEN: '${{ secrets.GH_PAT }}'
+ SEALOS_TYPE: 'pr_comment'
+ SEALOS_FILENAME: 'report.md'
+ SEALOS_REPLACE_TAG: 'DEFAULT_REPLACE_DEPLOY'
helm-check:
runs-on: ubuntu-20.04
diff --git a/projects/app/Dockerfile b/projects/app/Dockerfile
index 0ffa7b37aec0..5142d120798f 100644
--- a/projects/app/Dockerfile
+++ b/projects/app/Dockerfile
@@ -82,7 +82,6 @@ COPY ./projects/app/data /app/data
RUN chown -R nextjs:nodejs /app/data
# Add tmp directory permission control
-RUN mkdir -p /tmp && chmod 666 /tmp
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
diff --git a/projects/app/src/components/support/user/team/UpdateInviteModal/index.tsx b/projects/app/src/components/support/user/team/UpdateInviteModal/index.tsx
index 455fc53ac4a0..a710da4e12a2 100644
--- a/projects/app/src/components/support/user/team/UpdateInviteModal/index.tsx
+++ b/projects/app/src/components/support/user/team/UpdateInviteModal/index.tsx
@@ -1,53 +1,50 @@
-import React, { useEffect } from 'react';
+import React from 'react';
import { useTranslation } from 'next-i18next';
import MyModal from '@fastgpt/web/components/common/MyModal';
-import {
- Button,
- ModalFooter,
- useDisclosure,
- ModalBody,
- Flex,
- Box,
- useTheme
-} from '@chakra-ui/react';
-import { useQuery } from '@tanstack/react-query';
+import { Button, ModalFooter, ModalBody, Flex, Box, useTheme } from '@chakra-ui/react';
import { getTeamList, updateInviteResult } from '@/web/support/user/team/api';
import { TeamMemberStatusEnum } from '@fastgpt/global/support/user/team/constant';
import Avatar from '@fastgpt/web/components/common/Avatar';
-import { useRequest } from '@fastgpt/web/hooks/useRequest';
import { useToast } from '@fastgpt/web/hooks/useToast';
import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
import { useSystemStore } from '@/web/common/system/useSystemStore';
+import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
+import { useUserStore } from '@/web/support/user/useUserStore';
const UpdateInviteModal = () => {
const { t } = useTranslation();
const theme = useTheme();
const { toast } = useToast();
- const { ConfirmModal, openConfirm } = useConfirm({});
const { feConfigs } = useSystemStore();
+ const { initUserInfo } = useUserStore();
+
+ const { ConfirmModal, openConfirm } = useConfirm({});
- const { data: inviteList = [], refetch } = useQuery(['getInviteList'], () =>
- feConfigs.isPlus ? getTeamList(TeamMemberStatusEnum.waiting) : []
+ const { data: inviteList = [], run: fetchInviteList } = useRequest2(
+ async () => (feConfigs.isPlus ? getTeamList(TeamMemberStatusEnum.waiting) : []),
+ {
+ manual: false
+ }
);
- const { mutate: onAccept, isLoading: isLoadingAccept } = useRequest({
- mutationFn: updateInviteResult,
+ const { runAsync: onAccept, loading: isLoadingAccept } = useRequest2(updateInviteResult, {
onSuccess() {
toast({
status: 'success',
title: t('common:user.team.invite.Accepted')
});
- refetch();
+ fetchInviteList();
+ initUserInfo();
}
});
- const { mutate: onReject, isLoading: isLoadingReject } = useRequest({
- mutationFn: updateInviteResult,
+ const { runAsync: onReject, loading: isLoadingReject } = useRequest2(updateInviteResult, {
onSuccess() {
toast({
status: 'success',
title: t('common:user.team.invite.Reject')
});
- refetch();
+ fetchInviteList();
+ initUserInfo();
}
});
@@ -59,7 +56,7 @@ const UpdateInviteModal = () => {
{t('common:user.team.Processing invitations')}
- {t('user.team.Processing invitations Tips', { amount: inviteList?.length })}
+ {t('common:user.team.Processing invitations Tips', { amount: inviteList?.length })}
}
diff --git a/projects/app/src/pages/account/team/index.tsx b/projects/app/src/pages/account/team/index.tsx
index 6307d5c4be02..f7ec577d6e68 100644
--- a/projects/app/src/pages/account/team/index.tsx
+++ b/projects/app/src/pages/account/team/index.tsx
@@ -10,8 +10,6 @@ import { useContextSelector } from 'use-context-selector';
import { useRouter } from 'next/router';
import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs';
import MyIcon from '@fastgpt/web/components/common/Icon';
-import { useToast } from '@fastgpt/web/hooks/useToast';
-import { useSystemStore } from '@/web/common/system/useSystemStore';
import { TeamMemberRoleEnum } from '@fastgpt/global/support/user/team/constant';
import { TeamContext, TeamModalContextProvider } from './components/context';
import dynamic from 'next/dynamic';
diff --git a/projects/app/src/pages/api/support/user/account/loginout.ts b/projects/app/src/pages/api/support/user/account/loginout.ts
index be33eae62a02..1d81187f3432 100644
--- a/projects/app/src/pages/api/support/user/account/loginout.ts
+++ b/projects/app/src/pages/api/support/user/account/loginout.ts
@@ -1,15 +1,9 @@
import type { NextApiRequest, NextApiResponse } from 'next';
-import { jsonRes } from '@fastgpt/service/common/response';
import { clearCookie } from '@fastgpt/service/support/permission/controller';
+import { NextAPI } from '@/service/middleware/entry';
-export default async function handler(req: NextApiRequest, res: NextApiResponse) {
- try {
- clearCookie(res);
- jsonRes(res);
- } catch (err) {
- jsonRes(res, {
- code: 500,
- error: err
- });
- }
+async function handler(req: NextApiRequest, res: NextApiResponse) {
+ clearCookie(res);
}
+
+export default NextAPI(handler);