File tree Expand file tree Collapse file tree 4 files changed +26
-44
lines changed
Expand file tree Collapse file tree 4 files changed +26
-44
lines changed Original file line number Diff line number Diff line change 1- import { useQuery , UseQueryResult } from "react-query" ;
1+ import { useQuery , UseQueryResult } from "react-query" ;
22import axios from "axios" ;
3- import { IResponse , ISpeaker } from "./Speaker.types" ;
3+ import { ISpeaker } from "./Speaker.types" ;
4+ import { speakerAdapter } from "../../services/speakerAdapter" ;
45
56export const useFetchSpeakers = ( id ?: string ) : UseQueryResult < ISpeaker [ ] > => {
67 return useQuery ( "api-speakers" , async ( ) => {
@@ -18,16 +19,4 @@ export const useFetchSpeakers = (id?: string): UseQueryResult<ISpeaker[]> => {
1819 return speakerAdapter ( returnData ) ;
1920 } ) ;
2021} ;
21- export const speakerAdapter = ( response : IResponse [ ] ) : ISpeaker [ ] =>
22- response . map ( ( response ) => ( {
23- id : response . id ,
24- fullName : response . fullName ,
25- speakerImage : response . profilePicture ,
26- tagLine : response . tagLine ,
27- bio : response . bio ,
28- sessions : response . sessions ,
29- twitterUrl : response . links . filter ( ( link ) => link . linkType === "Twitter" ) [ 0 ] ,
30- linkedInUrl : response . links . filter (
31- ( link ) => link . linkType === "LinkedIn"
32- ) [ 0 ] ,
33- } ) ) ;
22+
Original file line number Diff line number Diff line change 11import { useQuery , UseQueryResult } from "react-query" ;
22import axios from "axios" ;
3- import { IResponse , ISpeaker } from "../../views/Speakers/Speaker.types" ;
3+ import { ISpeaker } from "../../views/Speakers/Speaker.types" ;
4+ import { speakerAdapter } from "../../services/speakerAdapter" ;
45
56export const useFetchSpeakers = ( id ?: string ) : UseQueryResult < ISpeaker [ ] > => {
67 return useQuery ( "api-speakers" , async ( ) => {
@@ -18,16 +19,4 @@ export const useFetchSpeakers = (id?: string): UseQueryResult<ISpeaker[]> => {
1819 return speakerAdapter ( returnData ) ;
1920 } ) ;
2021} ;
21- export const speakerAdapter = ( response : IResponse [ ] ) : ISpeaker [ ] =>
22- response . map ( ( response ) => ( {
23- id : response . id ,
24- fullName : response . fullName ,
25- speakerImage : response . profilePicture ,
26- tagLine : response . tagLine ,
27- bio : response . bio ,
28- sessions : response . sessions ,
29- twitterUrl : response . links . filter ( ( link ) => link . linkType === "Twitter" ) [ 0 ] ,
30- linkedInUrl : response . links . filter (
31- ( link ) => link . linkType === "LinkedIn" ,
32- ) [ 0 ] ,
33- } ) ) ;
22+
Original file line number Diff line number Diff line change 1+ import { IResponse , ISpeaker } from "../views/Speakers/Speaker.types" ;
2+
3+ export const speakerAdapter = ( response : IResponse [ ] ) : ISpeaker [ ] =>
4+ response . map ( ( response ) => ( {
5+ id : response . id ,
6+ fullName : response . fullName ,
7+ speakerImage : response . profilePicture ,
8+ tagLine : response . tagLine ,
9+ bio : response . bio ,
10+ sessions : response . sessions ,
11+ twitterUrl : response . links . filter ( ( link ) => link . linkType === "Twitter" ) [ 0 ] ,
12+ linkedInUrl : response . links . filter (
13+ ( link ) => link . linkType === "LinkedIn" ,
14+ ) [ 0 ] ,
15+ } ) ) ;
Original file line number Diff line number Diff line change 1- import { useQuery , UseQueryResult } from "react-query" ;
1+ import { useQuery , UseQueryResult } from "react-query" ;
22import axios from "axios" ;
3- import { IResponse , ISpeaker } from "./Speaker.types" ;
3+ import { ISpeaker } from "./Speaker.types" ;
4+ import { speakerAdapter } from "../../services/speakerAdapter" ;
45
56export const useFetchSpeakers = ( id ?: string ) : UseQueryResult < ISpeaker [ ] > => {
67 return useQuery ( "api-speakers" , async ( ) => {
@@ -18,16 +19,4 @@ export const useFetchSpeakers = (id?: string): UseQueryResult<ISpeaker[]> => {
1819 return speakerAdapter ( returnData ) ;
1920 } ) ;
2021} ;
21- export const speakerAdapter = ( response : IResponse [ ] ) : ISpeaker [ ] =>
22- response . map ( ( response ) => ( {
23- id : response . id ,
24- fullName : response . fullName ,
25- speakerImage : response . profilePicture ,
26- tagLine : response . tagLine ,
27- bio : response . bio ,
28- sessions : response . sessions ,
29- twitterUrl : response . links . filter ( ( link ) => link . linkType === "Twitter" ) [ 0 ] ,
30- linkedInUrl : response . links . filter (
31- ( link ) => link . linkType === "LinkedIn" ,
32- ) [ 0 ] ,
33- } ) ) ;
22+
You can’t perform that action at this time.
0 commit comments