Skip to content

Commit

Permalink
Merge pull request #519 from tekdi/release-1.1.0
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
itsvick authored Feb 14, 2025
2 parents 1143609 + 1f77d9b commit 5684522
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/components/notification-templates/TemplateTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ const TemplateTable: React.FC<TemplateTableProps> = ({ searchKey = '', context }
const onEdit = (template: any) => {
console.log('Edit template with ID:', template);
router.push(`/notification-templates/update/${template.key}`)
router.push({
pathname: `/notification-templates/update/${template.key}`,
query: {
context: context,
}
});

}

Expand Down
13 changes: 12 additions & 1 deletion src/pages/notification-templates/update/[key].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { useTranslation } from 'next-i18next';
const UpdateTemplate: React.FC = () => {
const router = useRouter();
const { key } = router.query;
const { context } = router.query;

const { t } = useTranslation();

// Fetch data using TanStack Query
Expand All @@ -21,8 +23,17 @@ const UpdateTemplate: React.FC = () => {
// router.push('/notification-templates');
throw new Error('Invalid key');
}
const response = await getNotificationTemplateByKey({ key });
let response;
if(context)
{
response = await getNotificationTemplateByKey({ key,context: context.toString() });
}
else{
response = await getNotificationTemplateByKey({ key});

}
return response;

},
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
retry: 1, // Retry once on failure
Expand Down

0 comments on commit 5684522

Please sign in to comment.