feat(reports): allow to suspend a profile or a user account directly from the report view
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import { ApolloClient, NormalizedCacheObject } from "@apollo/client/core";
|
||||
import {
|
||||
ApolloClient,
|
||||
ApolloQueryResult,
|
||||
NormalizedCacheObject,
|
||||
OperationVariables,
|
||||
} from "@apollo/client/core";
|
||||
import buildCurrentUserResolver from "@/apollo/user";
|
||||
import { cache } from "./apollo/memory";
|
||||
import { fullLink } from "./apollo/link";
|
||||
import { UseQueryReturn } from "@vue/apollo-composable";
|
||||
|
||||
export const apolloClient = new ApolloClient<NormalizedCacheObject>({
|
||||
cache,
|
||||
@@ -9,3 +15,24 @@ export const apolloClient = new ApolloClient<NormalizedCacheObject>({
|
||||
connectToDevTools: true,
|
||||
resolvers: buildCurrentUserResolver(cache),
|
||||
});
|
||||
|
||||
export function waitApolloQuery<
|
||||
TResult = any,
|
||||
TVariables extends OperationVariables = OperationVariables,
|
||||
>({
|
||||
onResult,
|
||||
onError,
|
||||
}: UseQueryReturn<TResult, TVariables>): Promise<ApolloQueryResult<TResult>> {
|
||||
return new Promise((res, rej) => {
|
||||
const { off: offResult } = onResult((result) => {
|
||||
if (result.loading === false) {
|
||||
offResult();
|
||||
res(result);
|
||||
}
|
||||
});
|
||||
const { off: offError } = onError((error) => {
|
||||
offError();
|
||||
rej(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user