more validation

This commit is contained in:
Hailey
2024-06-14 16:26:54 -07:00
parent 5349e46bc4
commit e20cd9c1cf
+10 -2
View File
@@ -38,6 +38,8 @@ import {Text} from '#/components/Typography'
export function StarterPackScreen({
route,
}: NativeStackScreenProps<CommonNavigatorParams, 'StarterPack'>) {
const {_} = useLingui()
const {name, rkey} = route.params
const {
data: did,
@@ -50,11 +52,17 @@ export function StarterPackScreen({
isError: isErrorStarterPack,
} = useStarterPackQuery({did, rkey})
if (!did || !starterPack) {
const isValid =
starterPack &&
AppBskyGraphDefs.validateStarterPackView(starterPack) &&
AppBskyGraphStarterpack.validateRecord(starterPack.record)
if (!did || !starterPack || !isValid) {
return (
<ListMaybePlaceholder
isLoading={isLoadingDid || isLoadingStarterPack}
isError={isErrorDid || isErrorStarterPack}
isError={isErrorDid || isErrorStarterPack || !isValid}
errorMessage={_(msg`That starter pack could not be found.`)}
/>
)
}