more validation
This commit is contained in:
@@ -38,6 +38,8 @@ import {Text} from '#/components/Typography'
|
|||||||
export function StarterPackScreen({
|
export function StarterPackScreen({
|
||||||
route,
|
route,
|
||||||
}: NativeStackScreenProps<CommonNavigatorParams, 'StarterPack'>) {
|
}: NativeStackScreenProps<CommonNavigatorParams, 'StarterPack'>) {
|
||||||
|
const {_} = useLingui()
|
||||||
|
|
||||||
const {name, rkey} = route.params
|
const {name, rkey} = route.params
|
||||||
const {
|
const {
|
||||||
data: did,
|
data: did,
|
||||||
@@ -50,11 +52,17 @@ export function StarterPackScreen({
|
|||||||
isError: isErrorStarterPack,
|
isError: isErrorStarterPack,
|
||||||
} = useStarterPackQuery({did, rkey})
|
} = useStarterPackQuery({did, rkey})
|
||||||
|
|
||||||
if (!did || !starterPack) {
|
const isValid =
|
||||||
|
starterPack &&
|
||||||
|
AppBskyGraphDefs.validateStarterPackView(starterPack) &&
|
||||||
|
AppBskyGraphStarterpack.validateRecord(starterPack.record)
|
||||||
|
|
||||||
|
if (!did || !starterPack || !isValid) {
|
||||||
return (
|
return (
|
||||||
<ListMaybePlaceholder
|
<ListMaybePlaceholder
|
||||||
isLoading={isLoadingDid || isLoadingStarterPack}
|
isLoading={isLoadingDid || isLoadingStarterPack}
|
||||||
isError={isErrorDid || isErrorStarterPack}
|
isError={isErrorDid || isErrorStarterPack || !isValid}
|
||||||
|
errorMessage={_(msg`That starter pack could not be found.`)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user