Add await registry-informed getTypes method with smart entity tag validation

fuck type coloring madness
This commit is contained in:
2024-05-12 02:10:15 -05:00
parent 15666716a6
commit b3048086c3
4 changed files with 84 additions and 33 deletions

View File

@@ -9,10 +9,9 @@ import LookupInput from "@/components/form/LookupInput";
import ErrorCard from "@/components/common/ErrorCard";
import { Maybe } from "true-myth";
import type { TargetType } from "@/types";
import { getType } from "@/rdap";
const Index: NextPage = () => {
const { error, setTarget, setTargetType, submit } = useLookup();
const { error, setTarget, setTargetType, submit, getType } = useLookup();
const [detectedType, setDetectedType] = useState<Maybe<TargetType>>(
Maybe.nothing()
);
@@ -46,11 +45,11 @@ const Index: NextPage = () => {
<LookupInput
isLoading={isLoading}
detectedType={detectedType}
onChange={({ target, targetType }) => {
onChange={async ({ target, targetType }) => {
setTarget(target);
setTargetType(targetType);
const detectResult = getType(target);
const detectResult = await getType(target);
if (detectResult.isOk) {
setDetectedType(Maybe.just(detectResult.value));
} else {