Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Lera24 committed Dec 6, 2024
1 parent 92b71b1 commit 2e3ae84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ const fieldsToSend = ['name', 'description', 'type'];
const getSourcesList = async (params) => {
const fieldsToSend = ['page', 'size', 'q', 'sort', 'fields', 'id'];

const listResponseHandler = (items) => {
return items.map((item) => ({
...item,
type: item.type.toLowerCase(),
}));
};

const {
page,
size,
Expand All @@ -39,6 +46,7 @@ const getSourcesList = async (params) => {
sanitize(fieldsToSend),
camelToSnake(),
]);

try {
const response = await sourceService.listSources(
page,
Expand All @@ -53,7 +61,7 @@ const getSourcesList = async (params) => {
merge(getDefaultGetListResponse()),
]);
return {
items: applyTransform(items, []),
items: applyTransform(items, [listResponseHandler]),
next,
};
} catch (err) {
Expand All @@ -63,7 +71,9 @@ const getSourcesList = async (params) => {

const getSource = async ({ itemId: id }) => {
const itemResponseHandler = (item) => {
item.source.type = item.source.type.toLowerCase();
if(item.source.type) {
item.source.type = item.source.type.toLowerCase();
}
return item.source;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</template>

<template #type="{ item }">
{{ t(`lookups.sources.types[${item.type}]`) }}
{{ t(`lookups.sources.types.${item.type}`) }}
</template>

<template #description="{ item }">
Expand Down

0 comments on commit 2e3ae84

Please sign in to comment.