nicolium: move make it hopefully compile
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -32,9 +32,8 @@ const useDomains = () => {
|
||||
mutationFn: (params: CreateDomainParams) => client.admin.domains.createDomain(params),
|
||||
retry: false,
|
||||
onSuccess: (data) =>
|
||||
queryClient.setQueryData(
|
||||
queryKeys.admin.domains,
|
||||
(prevResult: ReadonlyArray<AdminDomain>) => [...prevResult, data],
|
||||
queryClient.setQueryData(queryKeys.admin.domains, (prevResult) =>
|
||||
prevResult ? [...prevResult, data] : undefined,
|
||||
),
|
||||
});
|
||||
|
||||
@ -43,8 +42,8 @@ const useDomains = () => {
|
||||
client.admin.domains.updateDomain(id, params.public),
|
||||
retry: false,
|
||||
onSuccess: (data) =>
|
||||
queryClient.setQueryData(queryKeys.admin.domains, (prevResult: ReadonlyArray<AdminDomain>) =>
|
||||
prevResult.map((domain) => (domain.id === data.id ? data : domain)),
|
||||
queryClient.setQueryData(queryKeys.admin.domains, (prevResult) =>
|
||||
prevResult?.map((domain) => (domain.id === data.id ? data : domain)),
|
||||
),
|
||||
});
|
||||
|
||||
@ -52,8 +51,8 @@ const useDomains = () => {
|
||||
mutationFn: (id: string) => client.admin.domains.deleteDomain(id),
|
||||
retry: false,
|
||||
onSuccess: (_, id) =>
|
||||
queryClient.setQueryData(queryKeys.admin.domains, (prevResult: ReadonlyArray<AdminDomain>) =>
|
||||
prevResult.filter(({ id: domainId }) => domainId !== id),
|
||||
queryClient.setQueryData(queryKeys.admin.domains, (prevResult) =>
|
||||
prevResult?.filter(({ id: domainId }) => domainId !== id),
|
||||
),
|
||||
});
|
||||
|
||||
|
||||
@ -22,18 +22,17 @@ const useRelays = () => {
|
||||
mutationFn: (relayUrl: string) => client.admin.relays.followRelay(relayUrl),
|
||||
retry: false,
|
||||
onSuccess: (data) =>
|
||||
queryClient.setQueryData(queryKeys.admin.relays, (prevResult: ReadonlyArray<AdminRelay>) => [
|
||||
...prevResult,
|
||||
data,
|
||||
]),
|
||||
queryClient.setQueryData(queryKeys.admin.relays, (prevResult) =>
|
||||
prevResult ? [...prevResult, data] : undefined,
|
||||
),
|
||||
});
|
||||
|
||||
const { mutate: unfollowRelay, isPending: isPendingUnfollow } = useMutation({
|
||||
mutationFn: (relayUrl: string) => client.admin.relays.unfollowRelay(relayUrl),
|
||||
retry: false,
|
||||
onSuccess: (_, relayUrl) =>
|
||||
queryClient.setQueryData(queryKeys.admin.relays, (prevResult: ReadonlyArray<AdminRelay>) =>
|
||||
prevResult.filter(({ actor }) => actor !== relayUrl),
|
||||
queryClient.setQueryData(queryKeys.admin.relays, (prevResult) =>
|
||||
prevResult?.filter(({ actor }) => actor !== relayUrl),
|
||||
),
|
||||
});
|
||||
|
||||
|
||||
@ -35,18 +35,17 @@ const useRules = () => {
|
||||
mutationFn: (params: CreateRuleParams) => client.admin.rules.createRule(params),
|
||||
retry: false,
|
||||
onSuccess: (data) =>
|
||||
queryClient.setQueryData(queryKeys.admin.rules, (prevResult: ReadonlyArray<AdminRule>) => [
|
||||
...prevResult,
|
||||
data,
|
||||
]),
|
||||
queryClient.setQueryData(queryKeys.admin.rules, (prevResult) =>
|
||||
prevResult ? [...prevResult, data] : undefined,
|
||||
),
|
||||
});
|
||||
|
||||
const { mutate: updateRule, isPending: isUpdating } = useMutation({
|
||||
mutationFn: ({ id, ...params }: UpdateRuleParams) => client.admin.rules.updateRule(id, params),
|
||||
retry: false,
|
||||
onSuccess: (data) =>
|
||||
queryClient.setQueryData(queryKeys.admin.rules, (prevResult: ReadonlyArray<AdminRule>) =>
|
||||
prevResult.map((rule) => (rule.id === data.id ? data : rule)),
|
||||
queryClient.setQueryData(queryKeys.admin.rules, (prevResult) =>
|
||||
prevResult?.map((rule) => (rule.id === data.id ? data : rule)),
|
||||
),
|
||||
});
|
||||
|
||||
@ -54,8 +53,8 @@ const useRules = () => {
|
||||
mutationFn: (id: string) => client.admin.rules.deleteRule(id),
|
||||
retry: false,
|
||||
onSuccess: (_, id) =>
|
||||
queryClient.setQueryData(queryKeys.admin.rules, (prevResult: ReadonlyArray<AdminRule>) =>
|
||||
prevResult.filter(({ id: ruleId }) => ruleId !== id),
|
||||
queryClient.setQueryData(queryKeys.admin.rules, (prevResult) =>
|
||||
prevResult?.filter(({ id: ruleId }) => ruleId !== id),
|
||||
),
|
||||
});
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ import type {
|
||||
Group,
|
||||
GroupRelationship,
|
||||
GroupRole,
|
||||
Location,
|
||||
Marker,
|
||||
NotificationGroup,
|
||||
OauthToken,
|
||||
@ -35,6 +36,7 @@ import type {
|
||||
Poll,
|
||||
Relationship,
|
||||
RssFeed,
|
||||
Tag,
|
||||
Translation,
|
||||
} from 'pl-api';
|
||||
|
||||
@ -340,17 +342,30 @@ const markers = {
|
||||
|
||||
const search = {
|
||||
root: ['search'] as const,
|
||||
accounts: (query: string, params?: Record<string, unknown>) =>
|
||||
['search', 'accounts', query, params] as const,
|
||||
statuses: (query: string, params?: Record<string, unknown>) =>
|
||||
['search', 'statuses', query, params] as const,
|
||||
hashtags: (query: string, params?: Record<string, unknown>) =>
|
||||
['search', 'hashtags', query, params] as const,
|
||||
groups: (query: string, params?: Record<string, unknown>) =>
|
||||
['search', 'groups', query, params] as const,
|
||||
accountSearch: (query: string, params?: Record<string, unknown>) =>
|
||||
['search', 'accountSearch', query, params] as const,
|
||||
location: (query: string) => ['search', 'location', query] as const,
|
||||
accounts: (query: string, params?: Record<string, unknown>) => {
|
||||
const key = ['search', 'accounts', query, params] as const;
|
||||
return key as TaggedKey<typeof key, InfiniteData<PaginatedResponse<string>>>;
|
||||
},
|
||||
statuses: (query: string, params?: Record<string, unknown>) => {
|
||||
const key = ['search', 'statuses', query, params] as const;
|
||||
return key as TaggedKey<typeof key, InfiniteData<PaginatedResponse<string>>>;
|
||||
},
|
||||
hashtags: (query: string, params?: Record<string, unknown>) => {
|
||||
const key = ['search', 'hashtags', query, params] as const;
|
||||
return key as TaggedKey<typeof key, InfiniteData<PaginatedResponse<Tag>>>;
|
||||
},
|
||||
groups: (query: string, params?: Record<string, unknown>) => {
|
||||
const key = ['search', 'groups', query, params] as const;
|
||||
return key as TaggedKey<typeof key, InfiniteData<PaginatedResponse<string>>>;
|
||||
},
|
||||
accountSearch: (query: string, params?: Record<string, unknown>) => {
|
||||
const key = ['search', 'accountSearch', query, params] as const;
|
||||
return key as TaggedKey<typeof key, InfiniteData<PaginatedResponse<string>>>;
|
||||
},
|
||||
location: (query: string) => {
|
||||
const key = ['search', 'location', query] as const;
|
||||
return key as TaggedKey<typeof key, InfiniteData<PaginatedResponse<Location>>>;
|
||||
},
|
||||
};
|
||||
|
||||
const trends = {
|
||||
|
||||
Reference in New Issue
Block a user