feat: 完成模板管理阶段4闭环
This commit is contained in:
1 parent
b1e8012ded
commit
d1958a7d7f
26 files changed
+1179
-310
No files matched your search
@@ -24,7 +24,8 @@ export function usePublicationMutations({
|
||||
}: MutationOptions) {
|
||||
const queryClient = useQueryClient();
|
||||
const install = useMutation({
|
||||
mutationFn: (key: BrandTemplateKey) => client.installAdminTemplate(key),
|
||||
mutationFn: ({ key, versionId }: { key: BrandTemplateKey; versionId?: string }) =>
|
||||
client.installAdminTemplate(key, versionId),
|
||||
onSuccess: () => {
|
||||
onInstallClose();
|
||||
message.success("行业模板已安装");
|
||||
@@ -55,9 +56,23 @@ export function usePublicationMutations({
|
||||
refresh();
|
||||
},
|
||||
});
|
||||
const importSample = useMutation<Awaited<ReturnType<typeof client.importAdminSampleContent>>>({
|
||||
mutationFn: () => client.importAdminSampleContent(),
|
||||
onSuccess: ({ counts }) => {
|
||||
const importSample = useMutation<
|
||||
Awaited<ReturnType<typeof client.importAdminSampleContent>>,
|
||||
Error,
|
||||
string | undefined
|
||||
>({
|
||||
mutationFn: (templatePackageVersionId) =>
|
||||
client.importAdminSampleContent({
|
||||
...(templatePackageVersionId ? { templatePackageVersionId } : {}),
|
||||
strategy: "missing_only",
|
||||
confirm: true,
|
||||
}),
|
||||
onSuccess: ({ counts, alreadyImported }) => {
|
||||
if (alreadyImported) {
|
||||
message.info("该模板包版本的示例内容已导入,未重复创建");
|
||||
refresh();
|
||||
return;
|
||||
}
|
||||
message.success(
|
||||
counts.inquiryForms
|
||||
? "示例内容和客户咨询表单已导入草稿"
|
||||
|
||||
Reference in new issue
Block a user