Skip to content

Commit 74e313e

Browse files
committed
basic enhancer function
1 parent 3161e29 commit 74e313e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
import { FEHostedContent } from 'src/frontend/feHostedContent';
22

3+
enum HostedContentType {
4+
Article,
5+
Video,
6+
Gallery,
7+
}
8+
39
export type HostedContent = {
410
frontendData: FEHostedContent;
11+
type: HostedContentType;
12+
};
13+
14+
export const enhanceHostedContentType = (
15+
data: FEHostedContent,
16+
): HostedContent => {
17+
let type = HostedContentType.Article;
18+
19+
if (data.video) {
20+
type = HostedContentType.Video;
21+
} else if (data.images.length) {
22+
type = HostedContentType.Gallery;
23+
}
24+
25+
return {
26+
frontendData: data,
27+
type,
28+
};
529
};

0 commit comments

Comments
 (0)