Skip to content

Commit

Permalink
feat: incorrect download of design from client
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 fe9d911 commit 279c26f
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, EditIcon, KanvasIcon, PublishIcon } from '../../icons';
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, StyledActionWrapper, UnpublishAction } from './style';
import { RESOURCE_TYPES } from './types';

Expand Down Expand Up @@ -79,9 +79,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 279c26f

Please sign in to comment.