Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/nestjs-backend/src/features/base/base.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ export class BaseService {
});
return {
baseId: snapshot.baseId,
defaultUrl,
};
}

Expand All @@ -658,6 +659,7 @@ export class BaseService {

return {
baseId: snapshot.baseId,
defaultUrl,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,16 @@ export const PublishBaseDialog = (props: IPublishBaseDialogProps) => {
}).then((res) => res.data);
},
onSuccess: (data) => {
const { baseId: templateBaseId } = data;
const { baseId: templateBaseId, defaultUrl } = data;
queryClient.invalidateQueries({ queryKey: ['template-by-base', baseId] });
// after publish success, clear the uploaded cover, use server data next time
setUploadedCover(null);
// Close the publish dialog and show success dialog
setOpen(false);
// Generate share URL based on baseId
const origin = typeof window !== 'undefined' ? window.location.origin : '';
setShareUrl(`${origin}/base/${templateBaseId}`);
const url = defaultUrl || `/base/${templateBaseId}`;
setShareUrl(`${origin}${url}`);
setSuccessDialogOpen(true);
// Trigger fireworks effect
fireConfetti();
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi/src/base/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const PublishBaseRoute: RouteConfig = registerRoute({
});

export const publishBase = async (baseId: string, publishBaseRo: IPublishBaseRo) => {
return await axios.post<{ baseId: string }>(
return await axios.post<{ baseId: string; defaultUrl: string }>(
urlBuilder(PUBLISH_BASE, {
baseId,
}),
Expand Down