From 5218e854c846d285fb7a85f62fb02c69167a2955 Mon Sep 17 00:00:00 2001 From: harris2012 Date: Mon, 6 Feb 2023 10:46:26 +0000 Subject: [PATCH] feat: add renameProjectApi Signed-off-by: harris2012 --- src/api/path/project.api.ts | 10 ++++++++++ src/views/chart/ContentHeader/headerTitle/index.vue | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/api/path/project.api.ts b/src/api/path/project.api.ts index 164df1d3..42ce43ab 100644 --- a/src/api/path/project.api.ts +++ b/src/api/path/project.api.ts @@ -62,6 +62,16 @@ export const updateProjectApi = async (data: object) => { } } +// * 重命名项目名称 +export const renameProjectApi = async (data: object) => { + try { + const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/rename`, data) + return res + } catch { + httpErrorHandle() + } +} + // * 删除项目 export const deleteProjectApi = async (data: object) => { try { diff --git a/src/views/chart/ContentHeader/headerTitle/index.vue b/src/views/chart/ContentHeader/headerTitle/index.vue index b3724513..6f1729bb 100644 --- a/src/views/chart/ContentHeader/headerTitle/index.vue +++ b/src/views/chart/ContentHeader/headerTitle/index.vue @@ -32,7 +32,7 @@ import { ResultEnum } from '@/enums/httpEnum' import { fetchRouteParamsLocation, httpErrorHandle, setTitle } from '@/utils' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { ProjectInfoEnum, EditCanvasConfigEnum } from '@/store/modules/chartEditStore/chartEditStore.d' -import { updateProjectApi } from '@/api/path' +import { renameProjectApi } from '@/api/path' import { useSync } from '../../hooks/useSync.hook' import { icon } from '@/plugins' @@ -68,7 +68,7 @@ const handleFocus = () => { const handleBlur = async () => { focus.value = false chartEditStore.setProjectInfo(ProjectInfoEnum.PROJECT_NAME, title.value || '') - const res = (await updateProjectApi({ + const res = (await renameProjectApi({ id: fetchRouteParamsLocation(), projectName: title.value }))