Skip to content

Commit

Permalink
eslint fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jg210 committed Mar 7, 2024
1 parent 0745601 commit 416478e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Authorities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Suspense } from "react";
import { FlatList, Text } from "react-native";

interface localAuthorities {
localAuthorities: LocalAuthority[]
localAuthorities: LocalAuthority[];
}

interface LocalAuthority {
Expand All @@ -13,8 +13,10 @@ interface LocalAuthority {

const queryKey = ["authorities"];
const getAuthorities: () => Promise<LocalAuthority[]> = async () => {
const authorities = await fetch("https://aws.jeremygreen.me.uk/api/fsa/localAuthority");
const json = await authorities.json() as unknown as localAuthorities;
const authorities = await fetch(
"https://aws.jeremygreen.me.uk/api/fsa/localAuthority",
);
const json = (await authorities.json()) as unknown as localAuthorities;
return json.localAuthorities;
};

Expand All @@ -28,12 +30,12 @@ const Fallback = () => <Text>loading...</Text>;
export const Authorities = () => {
const { data } = useSuspenseQuery({ queryKey, queryFn: getAuthorities });
return (
<Suspense fallback={<Fallback/>}>
<FlatList
data={data}
renderItem={({ item }) => <Item name={item.name} />}
keyExtractor={(item) => item.localAuthorityId.toString()}
/>
<Suspense fallback={<Fallback />}>
<FlatList
data={data}
renderItem={({ item }) => <Item name={item.name} />}
keyExtractor={(item) => item.localAuthorityId.toString()}
/>
</Suspense>
);
};

0 comments on commit 416478e

Please sign in to comment.