Skip to content

Commit

Permalink
fix: incorrect design download
Browse files Browse the repository at this point in the history
Signed-off-by: Md Kaif Ansari <[email protected]>
  • Loading branch information
mdkaifansari04 committed Dec 9, 2024
1 parent a9e8d5c commit 2cc3b44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/custom/CatalogDetail/ActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CopyIcon, DeleteIcon, EditIcon, KanvasIcon, PublishIcon } from '../../i
import Download from '../../icons/Download/Download';
import { charcoal, useTheme } from '../../theme';
import { Pattern } from '../CustomCatalog/CustomCard';
import { downloadFilter, downloadYaml } from './helper';
import { downloadPattern, downloadYaml } from './helper';
import { ActionButton, DangerActionButton, StyledActionWrapper } from './style';
import { RESOURCE_TYPES } from './types';

Expand Down Expand Up @@ -83,9 +83,9 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
color: theme.palette.text.default
}}
onClick={() =>
cleanedType === RESOURCE_TYPES.FILTERS
? downloadFilter(details.id, details.name)
: downloadYaml(details.pattern_file, details.name)
cleanedType === RESOURCE_TYPES.VIEWS
? downloadYaml(details.pattern_file, details.name)
: downloadPattern(details.id, details.name, cleanedType)
}
>
<Download width={24} height={24} fill={theme.palette.icon.default} />
Expand Down
5 changes: 3 additions & 2 deletions src/custom/CatalogDetail/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export function slugify(str: string): string {
return str;
}

export const downloadFilter = (id: string, name: string): void => {
const dataUri = `${process.env.API_ENDPOINT_PREFIX}/api/content/filters/download/${id}`;
export const downloadPattern = (id: string, name: string, type: string): void => {
const pattern = type === 'design' ? 'patterns' : 'filters';
const dataUri = `${process.env.API_ENDPOINT_PREFIX}/api/content/${pattern}/download/${id}`;

// Add the .wasm extension to the filename
const fileNameWithExtension = name + '.wasm';
Expand Down

0 comments on commit 2cc3b44

Please sign in to comment.