1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-02 14:20:03 +09:00

chore: temporary disable cctld suggestion

This commit is contained in:
uetchy 2021-02-25 16:49:47 +09:00
parent 7bd485c6d5
commit e169fbec47

View File

@ -1,8 +1,6 @@
import fetch from 'cross-fetch';
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { MdDomain } from 'react-icons/md'; import { MdDomain } from 'react-icons/md';
import useSWR from 'swr';
import { normalize } from '../../../util/text'; import { normalize } from '../../../util/text';
import { zones } from '../../../util/zones'; import { zones } from '../../../util/zones';
import { Card, DedicatedAvailability, Repeater } from '../core'; import { Card, DedicatedAvailability, Repeater } from '../core';
@ -18,9 +16,9 @@ export interface DomainrResponse {
}[]; }[];
} }
function fetcher(url: string) { // function fetcher(url: string) {
return fetch(url, {}).then((res) => res.json()); // return fetch(url, {}).then((res) => res.json());
} // }
const DomainCard: React.FC<{ query: string }> = ({ query }) => { const DomainCard: React.FC<{ query: string }> = ({ query }) => {
const { t } = useTranslation(); const { t } = useTranslation();
@ -41,22 +39,21 @@ const DomainCard: React.FC<{ query: string }> = ({ query }) => {
lowerCase.substring(m.index + 1) lowerCase.substring(m.index + 1)
); );
const { data } = useSWR<DomainrResponse>( // const { data } = useSWR<DomainrResponse>(
`/api/list/domain/${encodeURIComponent(query)}`, // `/api/list/domain/${encodeURIComponent(query)}`,
fetcher // fetcher
); // );
const cctldSuggestions = // const cctldSuggestions =
data?.results // data?.results
?.filter((res) => res.subdomain !== '' && res.path === '') // ?.filter((res) => res.subdomain !== '' && res.path === '')
?.map((res) => res.domain) ?? []; // ?.map((res) => res.domain) ?? [];
const names = const names =
// use Set() to eliminate dupes // use Set() to eliminate dupes
new Set([ new Set([
...['com', 'org', 'app', 'io'].map((tld) => lowerCase + '.' + tld), ...['com', 'org', 'app', 'io'].map((tld) => lowerCase + '.' + tld),
...domainHackSuggestions, ...domainHackSuggestions,
...cctldSuggestions,
]); ]);
const moreNames = new Set([ const moreNames = new Set([