Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(user-notification): Args null variant fix #16703

Merged
merged 14 commits into from
Nov 5, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ export class NotificationsService {

async getTemplates(locale?: Locale): Promise<HnippTemplate[]> {
locale = mapToLocale(locale as Locale)
const queryVariables = {
locale: mapToContentfulLocale(locale),
}
const queryVariables = { locale: mapToContentfulLocale(locale) }
const res = await this.cmsService.fetchData(GetTemplates, queryVariables)
return res.hnippTemplateCollection.items

return res.hnippTemplateCollection.items.map((template: HnippTemplate) => ({
...template,
args: template.args || [], // Ensure args is an array
}))
}

async getTemplate(
Expand All @@ -143,7 +145,8 @@ export class NotificationsService {
)
const items = res.hnippTemplateCollection.items
if (items.length > 0) {
return items[0]
const template = items[0]
return { ...template, args: template.args || [] } // Ensure args is an array
} else {
throw new NotFoundException(`Template not found for ID: ${templateId}`)
}
Expand Down
Loading