Create RaidGroupTransformer
Transforms data into RaidGroup objects
This commit is contained in:
parent
cb4fd491ac
commit
6ab2c2488d
1 changed files with 19 additions and 0 deletions
19
transformers/RaidGroupTransformer.tsx
Normal file
19
transformers/RaidGroupTransformer.tsx
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import * as Raid from './RaidTransformer'
|
||||
|
||||
// Transforms API response to RaidGroup object
|
||||
export function toObject(data: any) {
|
||||
return {
|
||||
id: data.id,
|
||||
name: {
|
||||
en: data.name_en,
|
||||
ja: data.name_jp,
|
||||
},
|
||||
raids: data.raids.map((raid: any) => Raid.toObject(raid)),
|
||||
difficulty: data.difficulty,
|
||||
section: data.section,
|
||||
order: data.order,
|
||||
extra: data.extra,
|
||||
guidebooks: data.guidebooks,
|
||||
hl: data.hl,
|
||||
} as RaidGroup
|
||||
}
|
||||
Loading…
Reference in a new issue