mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
enable @typescript-eslint/no-floating-promises for all files (#634)
Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>
This commit is contained in:
parent
f810ddd725
commit
6be629baf7
45 changed files with 149 additions and 165 deletions
|
|
@ -61,13 +61,6 @@ module.exports = {
|
|||
'@typescript-eslint/triple-slash-reference': 'off',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['packages/web/**', 'packages/services/*-worker/**'],
|
||||
rules: {
|
||||
// because this folder is excluded in tsconfig.json
|
||||
'@typescript-eslint/no-floating-promises': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
// TODO: replace with packages/web/**
|
||||
files: ['packages/web/app/src/components/v2/**', 'packages/web/app/pages/\\[orgId\\]/**'],
|
||||
|
|
|
|||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
|
@ -13,7 +13,6 @@
|
|||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": false
|
||||
},
|
||||
"files.autoSave": "off",
|
||||
"eslint.format.enable": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ async function main() {
|
|||
method: ['GET', 'HEAD'],
|
||||
url: '/_health',
|
||||
handler(req, res) {
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ async function main() {
|
|||
handler(_, res) {
|
||||
const isReady = readiness();
|
||||
reportReadiness(isReady);
|
||||
res.status(isReady ? 200 : 400).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(isReady ? 200 : 400).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ async function main() {
|
|||
method: ['GET'],
|
||||
url: '/_history',
|
||||
handler(_, res) {
|
||||
res.status(200).send(emailProvider.history); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send(emailProvider.history);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ async function main() {
|
|||
method: ['GET', 'HEAD'],
|
||||
url: '/_health',
|
||||
handler(_, res) {
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ async function main() {
|
|||
handler(_, res) {
|
||||
const isReady = ctx.readiness();
|
||||
reportReadiness(isReady);
|
||||
res.status(isReady ? 200 : 400).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(isReady ? 200 : 400).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ async function main() {
|
|||
method: ['GET', 'HEAD'],
|
||||
url: '/_health',
|
||||
handler(_, res) {
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ async function main() {
|
|||
url: '/_readiness',
|
||||
handler(_, res) {
|
||||
reportReadiness(true);
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
import type { RouteHandlerMethod, FastifyRequest, FastifyReply } from 'fastify';
|
||||
import { Registry } from '@hive/api';
|
||||
import { cleanRequestId } from '@hive/service-common';
|
||||
|
|
@ -244,22 +243,22 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth
|
|||
});
|
||||
|
||||
response.headers.forEach((value, key) => {
|
||||
reply.header(key, value);
|
||||
void reply.header(key, value);
|
||||
});
|
||||
|
||||
if (!reply.hasHeader('x-request-id')) {
|
||||
reply.header('x-request-id', requestId || '');
|
||||
void reply.header('x-request-id', requestId || '');
|
||||
}
|
||||
|
||||
const accept = req.headers.accept;
|
||||
|
||||
if (!accept || accept === '*/*') {
|
||||
reply.header('content-type', 'application/json');
|
||||
void reply.header('content-type', 'application/json');
|
||||
}
|
||||
|
||||
reply.status(response.status);
|
||||
void reply.status(response.status);
|
||||
|
||||
reply.send(response.body);
|
||||
void reply.send(response.body);
|
||||
|
||||
return reply;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ export async function startMetrics(instanceLabel: string | undefined) {
|
|||
url: '/metrics',
|
||||
async handler(req, res) {
|
||||
try {
|
||||
res.header('Content-Type', promClient.register.contentType); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.header('Content-Type', promClient.register.contentType);
|
||||
const result = await promClient.register.metrics();
|
||||
|
||||
res.send(result); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.send(result);
|
||||
} catch (error) {
|
||||
res.status(500).send(error); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(500).send(error);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -108,8 +108,7 @@ const plugin: FastifyPluginAsync = async server => {
|
|||
console.log('fastify.setErrorHandler error', err);
|
||||
Sentry.captureException(err);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
reply.send(
|
||||
void reply.send(
|
||||
JSON.stringify({
|
||||
error: 500,
|
||||
message: 'Internal Server Error',
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ async function main() {
|
|||
method: ['GET', 'HEAD'],
|
||||
url: '/_health',
|
||||
handler(_, res) {
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ async function main() {
|
|||
handler(_, res) {
|
||||
const isReady = readiness();
|
||||
reportReadiness(isReady);
|
||||
res.status(isReady ? 200 : 400).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(isReady ? 200 : 400).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ export async function main() {
|
|||
method: ['GET', 'HEAD'],
|
||||
url: '/_health',
|
||||
handler(req, res) {
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ export async function main() {
|
|||
handler(_, res) {
|
||||
const isReady = readiness();
|
||||
reportReadiness(isReady);
|
||||
res.status(isReady ? 200 : 400).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(isReady ? 200 : 400).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ async function main() {
|
|||
method: ['GET', 'HEAD'],
|
||||
url: '/_health',
|
||||
handler(_, res) {
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ async function main() {
|
|||
handler(_, res) {
|
||||
const isReady = context.readiness();
|
||||
reportReadiness(isReady);
|
||||
res.status(isReady ? 200 : 400).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(isReady ? 200 : 400).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ async function main() {
|
|||
method: ['GET', 'HEAD'],
|
||||
url: '/_health',
|
||||
handler(_, res) {
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ async function main() {
|
|||
handler(_, res) {
|
||||
const isReady = readiness();
|
||||
reportReadiness(isReady);
|
||||
res.status(isReady ? 200 : 400).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(isReady ? 200 : 400).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ async function main() {
|
|||
}
|
||||
|
||||
if (!token) {
|
||||
res.status(400).send('Missing token'); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(400).send('Missing token');
|
||||
httpRequestsWithoutToken.inc();
|
||||
return;
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ async function main() {
|
|||
});
|
||||
httpRequestsWithNonExistingToken.inc();
|
||||
req.log.info('Token not found (token=%s)', maskedToken);
|
||||
res.status(400).send('Missing token'); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(400).send('Missing token');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ async function main() {
|
|||
});
|
||||
httpRequestsWithNoAccess.inc();
|
||||
req.log.info('No access (token=%s)', maskedToken);
|
||||
res.status(403).send('No access'); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(403).send('No access');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ async function main() {
|
|||
.labels({ targetId: tokenInfo.target, orgId: tokenInfo.organization })
|
||||
.inc();
|
||||
req.log.info('Rate limited (token=%s)', maskedToken);
|
||||
res.status(429).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(429).send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ async function main() {
|
|||
try {
|
||||
const result = await collect(req.body, tokenInfo, retentionInfo);
|
||||
stopTimer();
|
||||
res.status(200).send(result); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send(result);
|
||||
} catch (error) {
|
||||
stopTimer();
|
||||
req.log.error('Failed to collect report (token=%s)', maskedToken);
|
||||
|
|
@ -158,7 +158,7 @@ async function main() {
|
|||
Sentry.captureException(error, {
|
||||
level: 'error',
|
||||
});
|
||||
res.status(500).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(500).send();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
@ -167,7 +167,7 @@ async function main() {
|
|||
method: ['GET', 'HEAD'],
|
||||
url: '/_health',
|
||||
handler(_, res) {
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ async function main() {
|
|||
handler(_, res) {
|
||||
const isReady = readiness();
|
||||
reportReadiness(isReady);
|
||||
res.status(isReady ? 200 : 400).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(isReady ? 200 : 400).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ async function main() {
|
|||
method: ['GET', 'HEAD'],
|
||||
url: '/_health',
|
||||
handler(req, res) {
|
||||
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(200).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ async function main() {
|
|||
handler(_, res) {
|
||||
const isReady = readiness();
|
||||
reportReadiness(isReady);
|
||||
res.status(isReady ? 200 : 400).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
|
||||
void res.status(isReady ? 200 : 400).send();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ const SchemaServiceName = ({
|
|||
});
|
||||
|
||||
const submit = useCallback(
|
||||
(newName: string) => {
|
||||
async (newName: string) => {
|
||||
if (schema.service === newName) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ const SchemaServiceName = ({
|
|||
return;
|
||||
}
|
||||
|
||||
mutate({
|
||||
await mutate({
|
||||
input: {
|
||||
organization: organization.cleanId,
|
||||
project: project.cleanId,
|
||||
|
|
@ -187,25 +187,24 @@ const SyncSchemaButton = ({
|
|||
const [status, setStatus] = useState<'idle' | 'error' | 'success'>('idle');
|
||||
const [mutation, mutate] = useMutation(SchemaSyncButton_SchemaSyncCDN);
|
||||
|
||||
const sync = useCallback(() => {
|
||||
mutate({
|
||||
const sync = useCallback(async () => {
|
||||
const result = await mutate({
|
||||
input: {
|
||||
organization: organization.cleanId,
|
||||
project: project.cleanId,
|
||||
target: target.cleanId,
|
||||
},
|
||||
}).then(result => {
|
||||
if (result.error) {
|
||||
setStatus('error');
|
||||
} else {
|
||||
setStatus(
|
||||
result.data?.schemaSyncCDN.__typename === 'SchemaSyncCDNError' ? 'error' : 'success',
|
||||
);
|
||||
}
|
||||
setTimeout(() => {
|
||||
setStatus('idle');
|
||||
}, 5000);
|
||||
});
|
||||
if (result.error) {
|
||||
setStatus('error');
|
||||
} else {
|
||||
setStatus(
|
||||
result.data?.schemaSyncCDN.__typename === 'SchemaSyncCDNError' ? 'error' : 'success',
|
||||
);
|
||||
}
|
||||
setTimeout(() => {
|
||||
setStatus('idle');
|
||||
}, 5000);
|
||||
}, [mutate, organization.cleanId, project.cleanId, target.cleanId]);
|
||||
|
||||
if (!target.hasSchema) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ const OperationsView = ({
|
|||
|
||||
const updatePeriod = useCallback<Exclude<ComponentProps<'select'>['onChange'], undefined | null>>(
|
||||
ev => {
|
||||
router.push(`${href}?period=${ev.target.value}`);
|
||||
void router.push(`${href}?period=${ev.target.value}`);
|
||||
},
|
||||
[href, router],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -189,8 +189,8 @@ const ExtendBaseSchema = (props: { baseSchema: string }): ReactElement => {
|
|||
variant="primary"
|
||||
className="px-5"
|
||||
disabled={mutation.fetching}
|
||||
onClick={() => {
|
||||
mutate({
|
||||
onClick={async () => {
|
||||
await mutate({
|
||||
input: {
|
||||
organization: router.organizationId,
|
||||
project: router.projectId,
|
||||
|
|
@ -402,8 +402,8 @@ const ConditionalBreakingChanges = (): ReactElement => {
|
|||
<Switch
|
||||
className="shrink-0"
|
||||
checked={isEnabled}
|
||||
onCheckedChange={enabled => {
|
||||
setValidation({
|
||||
onCheckedChange={async enabled => {
|
||||
await setValidation({
|
||||
input: {
|
||||
target: router.targetId,
|
||||
project: router.projectId,
|
||||
|
|
@ -484,8 +484,8 @@ const ConditionalBreakingChanges = (): ReactElement => {
|
|||
name="excludedClients"
|
||||
value={values.excludedClients}
|
||||
onBlur={() => setFieldTouched('excludedClients')}
|
||||
onChange={options => {
|
||||
setFieldValue(
|
||||
onChange={async options => {
|
||||
await setFieldValue(
|
||||
'excludedClients',
|
||||
options.map(o => o.value),
|
||||
);
|
||||
|
|
@ -505,8 +505,8 @@ const ConditionalBreakingChanges = (): ReactElement => {
|
|||
<div key={pt.id} className="flex items-center gap-2 pl-5">
|
||||
<Checkbox
|
||||
checked={values.targets.includes(pt.id)}
|
||||
onCheckedChange={isChecked => {
|
||||
setFieldValue(
|
||||
onCheckedChange={async isChecked => {
|
||||
await setFieldValue(
|
||||
'targets',
|
||||
isChecked
|
||||
? [...values.targets, pt.id]
|
||||
|
|
@ -615,7 +615,9 @@ const Page = ({
|
|||
}).then(result => {
|
||||
if (result?.data?.updateTargetName?.ok) {
|
||||
const newTargetId = result.data.updateTargetName.ok.updatedTarget.cleanId;
|
||||
router.replace(`/${router.organizationId}/${router.projectId}/${newTargetId}/settings`);
|
||||
void router.replace(
|
||||
`/${router.organizationId}/${router.projectId}/${newTargetId}/settings`,
|
||||
);
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ const Channels = (): ReactElement => {
|
|||
size="large"
|
||||
danger
|
||||
disabled={checked.length === 0 || mutation.fetching}
|
||||
onClick={() => {
|
||||
mutate({
|
||||
onClick={async () => {
|
||||
await mutate({
|
||||
input: {
|
||||
organization: router.organizationId,
|
||||
project: router.projectId,
|
||||
|
|
@ -173,8 +173,8 @@ const Page = (props: {
|
|||
size="large"
|
||||
danger
|
||||
disabled={checked.length === 0 || mutation.fetching}
|
||||
onClick={() => {
|
||||
mutate({
|
||||
onClick={async () => {
|
||||
await mutate({
|
||||
input: {
|
||||
organization: router.organizationId,
|
||||
project: router.projectId,
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ const TargetCard = ({
|
|||
</DropdownMenu.Trigger>
|
||||
<DropdownMenu.Content sideOffset={5} align="start">
|
||||
<DropdownMenu.Item
|
||||
onClick={e => {
|
||||
onClick={async e => {
|
||||
e.stopPropagation();
|
||||
copyToClipboard(`${window.location.origin}${href}`);
|
||||
await copyToClipboard(`${window.location.origin}${href}`);
|
||||
}}
|
||||
>
|
||||
<LinkIcon />
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ const Page = ({
|
|||
}).then(result => {
|
||||
if (result?.data?.updateProjectName?.ok) {
|
||||
const newProjectId = result.data.updateProjectName.ok.updatedProject.cleanId;
|
||||
router.replace(`/${router.organizationId}/${newProjectId}/settings`);
|
||||
void router.replace(`/${router.organizationId}/${newProjectId}/settings`);
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ const ProjectCard = ({
|
|||
</DropdownMenu.Trigger>
|
||||
<DropdownMenu.Content sideOffset={5} align="start">
|
||||
<DropdownMenu.Item
|
||||
onClick={e => {
|
||||
onClick={async e => {
|
||||
e.stopPropagation();
|
||||
copyToClipboard(`${window.location.origin}${href}`);
|
||||
await copyToClipboard(`${window.location.origin}${href}`);
|
||||
}}
|
||||
>
|
||||
<LinkIcon />
|
||||
|
|
|
|||
|
|
@ -155,8 +155,8 @@ const InvitationDeleteButton = ({
|
|||
return (
|
||||
<DropdownMenu.Item
|
||||
disabled={mutation.fetching}
|
||||
onClick={() => {
|
||||
mutate({
|
||||
onClick={async () => {
|
||||
await mutate({
|
||||
input: {
|
||||
organization: organizationCleanId,
|
||||
email,
|
||||
|
|
@ -264,7 +264,7 @@ const Page = ({ organization }: { organization: OrganizationFieldsFragment }) =>
|
|||
|
||||
useEffect(() => {
|
||||
if (isPersonal) {
|
||||
router.replace(`/${router.organizationId}`);
|
||||
void router.replace(`/${router.organizationId}`);
|
||||
} else if (members) {
|
||||
// uncheck checkboxes when members were deleted
|
||||
setChecked(prev => prev.filter(id => members.some(node => node.id === id)));
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ const Integrations = (): ReactElement => {
|
|||
size="large"
|
||||
danger
|
||||
disabled={deleteSlackMutation.fetching}
|
||||
onClick={() => {
|
||||
deleteSlack({
|
||||
onClick={async () => {
|
||||
await deleteSlack({
|
||||
input: {
|
||||
organization: orgId,
|
||||
},
|
||||
|
|
@ -88,8 +88,8 @@ const Integrations = (): ReactElement => {
|
|||
size="large"
|
||||
danger
|
||||
disabled={deleteGitHubMutation.fetching}
|
||||
onClick={() => {
|
||||
deleteGitHub({
|
||||
onClick={async () => {
|
||||
await deleteGitHub({
|
||||
input: {
|
||||
organization: orgId,
|
||||
},
|
||||
|
|
@ -175,7 +175,7 @@ const Page = ({ organization }: { organization: OrganizationFieldsFragment }) =>
|
|||
const newOrgId =
|
||||
result.data?.updateOrganizationName?.ok.updatedOrganizationPayload.selector
|
||||
.organization;
|
||||
router.replace(`/${newOrgId}/settings`);
|
||||
void router.replace(`/${newOrgId}/settings`);
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ const Inner = ({
|
|||
paymentMethodId = paymentMethod.id;
|
||||
}
|
||||
|
||||
upgradeToProMutation[1]({
|
||||
await upgradeToProMutation[1]({
|
||||
organization: organization.cleanId,
|
||||
monthlyLimits: {
|
||||
operations: operationsRateLimit * 1_000_000,
|
||||
|
|
@ -141,14 +141,14 @@ const Inner = ({
|
|||
});
|
||||
};
|
||||
|
||||
const downgrade = () => {
|
||||
downgradeToHobbyMutation[1]({
|
||||
const downgrade = async () => {
|
||||
await downgradeToHobbyMutation[1]({
|
||||
organization: organization.cleanId,
|
||||
});
|
||||
};
|
||||
|
||||
const updateLimits = () => {
|
||||
updateOrgRateLimitMutation[1]({
|
||||
const updateLimits = async () => {
|
||||
await updateOrgRateLimitMutation[1]({
|
||||
organization: organization.cleanId,
|
||||
monthlyLimits: {
|
||||
operations: operationsRateLimit * 1_000_000,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ function App({ Component, pageProps }: AppProps): ReactElement {
|
|||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
Session.doesSessionExist().then(async doesExist => {
|
||||
void Session.doesSessionExist().then(async doesExist => {
|
||||
if (!doesExist) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ const SuperTokensComponentNoSSR = dynamic(
|
|||
export default function Auth(props: { oidcProviderId: string | null }): React.ReactElement {
|
||||
React.useEffect(() => {
|
||||
if (props.oidcProviderId) {
|
||||
startAuthFlowForOIDCProvider(props.oidcProviderId);
|
||||
void startAuthFlowForOIDCProvider(props.oidcProviderId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ export default function Auth(props: { oidcProviderId: string | null }): React.Re
|
|||
new URLSearchParams(globalThis.window?.location.search ?? '').get('provider') === 'okta';
|
||||
|
||||
if (isOkta) {
|
||||
startAuthFlowForProvider('okta');
|
||||
void startAuthFlowForProvider('okta');
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,22 +30,19 @@ function OrganizationPage() {
|
|||
},
|
||||
});
|
||||
const [mutation, mutate] = useMutation(JoinOrganizationDocument);
|
||||
const accept = React.useCallback(() => {
|
||||
mutate({
|
||||
code,
|
||||
}).then(result => {
|
||||
if (result.data) {
|
||||
if (result.data.joinOrganization.__typename === 'OrganizationInvitationError') {
|
||||
notify(result.data.joinOrganization.message, 'error');
|
||||
} else {
|
||||
const org = result.data.joinOrganization.organization;
|
||||
notify(`You joined "${org.name}" organization`, 'success');
|
||||
router.visitOrganization({
|
||||
organizationId: org.cleanId,
|
||||
});
|
||||
}
|
||||
const accept = React.useCallback(async () => {
|
||||
const result = await mutate({ code });
|
||||
if (result.data) {
|
||||
if (result.data.joinOrganization.__typename === 'OrganizationInvitationError') {
|
||||
notify(result.data.joinOrganization.message, 'error');
|
||||
} else {
|
||||
const org = result.data.joinOrganization.organization;
|
||||
notify(`You joined "${org.name}" organization`, 'success');
|
||||
router.visitOrganization({
|
||||
organizationId: org.cleanId,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [mutate, code, router, notify]);
|
||||
|
||||
const goBack = React.useCallback(() => {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ export function getServerSideProps() {
|
|||
export default function LogOutPage() {
|
||||
const router = useRouter();
|
||||
React.useEffect(() => {
|
||||
signOut().then(() => {
|
||||
router.replace('/');
|
||||
void signOut().then(() => {
|
||||
void router.replace('/');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ export const authenticated =
|
|||
if (await Session.attemptRefreshingSession()) {
|
||||
location.reload();
|
||||
} else {
|
||||
router.replace(`/auth?redirectToPath=${router.asPath}`);
|
||||
void router.replace(`/auth?redirectToPath=${router.asPath}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
doRefresh();
|
||||
void doRefresh();
|
||||
}, []);
|
||||
|
||||
if (props.fromSupertokens) {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export function OrganizationLayout({
|
|||
if (organizationQuery.error) {
|
||||
cookies.remove(LAST_VISITED_ORG_KEY);
|
||||
// url with # provoke error Maximum update depth exceeded
|
||||
push('/404', router.asPath.replace(/#.*/, ''));
|
||||
void push('/404', router.asPath.replace(/#.*/, ''));
|
||||
}
|
||||
}, [organizationQuery.error, router]);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,23 +26,22 @@ export const OrganizationCreator: React.FC<{
|
|||
const [{ fetching }, mutate] = useMutation(CreateOrganizationDocument);
|
||||
const [name, setName] = React.useState('');
|
||||
const submit = React.useCallback(
|
||||
evt => {
|
||||
async evt => {
|
||||
evt.preventDefault();
|
||||
if (name) {
|
||||
mutate({
|
||||
const result = await mutate({
|
||||
input: {
|
||||
name,
|
||||
},
|
||||
}).then(result => {
|
||||
if (!result.data?.createOrganization.ok) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (!result.data?.createOrganization.ok) {
|
||||
return;
|
||||
}
|
||||
|
||||
onClose();
|
||||
router.visitOrganization({
|
||||
organizationId:
|
||||
result.data.createOrganization.ok.createdOrganizationPayload.organization.cleanId,
|
||||
});
|
||||
onClose();
|
||||
router.visitOrganization({
|
||||
organizationId:
|
||||
result.data.createOrganization.ok.createdOrganizationPayload.organization.cleanId,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -177,10 +177,10 @@ export function usePermissionsManager({
|
|||
);
|
||||
|
||||
const submit = React.useCallback(
|
||||
evt => {
|
||||
async evt => {
|
||||
evt.preventDefault();
|
||||
setState('LOADING');
|
||||
mutate({
|
||||
const result = await mutate({
|
||||
input: {
|
||||
organization: organization.cleanId,
|
||||
user: member.id,
|
||||
|
|
@ -188,15 +188,14 @@ export function usePermissionsManager({
|
|||
projectScopes,
|
||||
organizationScopes,
|
||||
},
|
||||
}).then(result => {
|
||||
setState('IDLE');
|
||||
if (result.error) {
|
||||
notify(`Failed to change access (reason: ${result.error.message}`, 'error');
|
||||
} else {
|
||||
onSuccess();
|
||||
notify('Member access saved', 'success');
|
||||
}
|
||||
});
|
||||
setState('IDLE');
|
||||
if (result.error) {
|
||||
notify(`Failed to change access (reason: ${result.error.message}`, 'error');
|
||||
} else {
|
||||
onSuccess();
|
||||
notify('Member access saved', 'success');
|
||||
}
|
||||
},
|
||||
[
|
||||
mutate,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export const OIDCIntegrationSection = (props: {
|
|||
const isDeleteOIDCIntegrationModalOpen = router.asPath.endsWith('#remove-oidc-integration');
|
||||
|
||||
const closeModal = () => {
|
||||
router.push(router.asPath.split('#')[0]);
|
||||
void router.push(router.asPath.split('#')[0]);
|
||||
};
|
||||
|
||||
const openCreateModalLink = `${router.asPath}#create-oidc-integration`;
|
||||
|
|
@ -56,7 +56,7 @@ export const OIDCIntegrationSection = (props: {
|
|||
href={openEditModalLink}
|
||||
onClick={ev => {
|
||||
ev.preventDefault();
|
||||
router.push(openEditModalLink);
|
||||
void router.push(openEditModalLink);
|
||||
}}
|
||||
>
|
||||
<KeyIcon className="mr-2" />
|
||||
|
|
@ -71,7 +71,7 @@ export const OIDCIntegrationSection = (props: {
|
|||
href={openDeleteModalLink}
|
||||
onClick={ev => {
|
||||
ev.preventDefault();
|
||||
router.push(openDeleteModalLink);
|
||||
void router.push(openDeleteModalLink);
|
||||
}}
|
||||
>
|
||||
Remove
|
||||
|
|
@ -84,7 +84,7 @@ export const OIDCIntegrationSection = (props: {
|
|||
href={openCreateModalLink}
|
||||
onClick={ev => {
|
||||
ev.preventDefault();
|
||||
router.push(openCreateModalLink);
|
||||
void router.push(openCreateModalLink);
|
||||
}}
|
||||
>
|
||||
<KeyIcon className="mr-2" />
|
||||
|
|
@ -99,7 +99,7 @@ export const OIDCIntegrationSection = (props: {
|
|||
organizationId={props.organization.id}
|
||||
openEditModalLink={openEditModalLink}
|
||||
transitionToManageScreen={() => {
|
||||
router.replace(openEditModalLink);
|
||||
void router.replace(openEditModalLink);
|
||||
}}
|
||||
/>
|
||||
<ManageOIDCIntegrationModal
|
||||
|
|
@ -529,8 +529,8 @@ const RemoveOIDCIntegrationModal = (props: {
|
|||
block
|
||||
danger
|
||||
disabled={mutation.fetching}
|
||||
onClick={() => {
|
||||
mutate({
|
||||
onClick={async () => {
|
||||
await mutate({
|
||||
input: { oidcIntegrationId },
|
||||
});
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -165,25 +165,23 @@ export const ExternalCompositionSettings = ({
|
|||
});
|
||||
|
||||
const handleSwitch = useCallback(
|
||||
(status: boolean) => {
|
||||
async (status: boolean) => {
|
||||
if (status) {
|
||||
setEnabled(true);
|
||||
} else {
|
||||
setEnabled(false);
|
||||
disableComposition({
|
||||
const result = await disableComposition({
|
||||
input: {
|
||||
project: project.cleanId,
|
||||
organization: organization.cleanId,
|
||||
},
|
||||
}).then(result => {
|
||||
const error =
|
||||
result.error?.message || result.data?.disableExternalSchemaComposition.error;
|
||||
if (error) {
|
||||
notify(error, 'error');
|
||||
// fallback to the previous state
|
||||
setEnabled(true);
|
||||
}
|
||||
});
|
||||
const error = result.error?.message || result.data?.disableExternalSchemaComposition.error;
|
||||
if (error) {
|
||||
notify(error, 'error');
|
||||
// fallback to the previous state
|
||||
setEnabled(true);
|
||||
}
|
||||
}
|
||||
},
|
||||
[disableComposition, setEnabled, notify],
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ export function SchemaExplorerFilter({
|
|||
defaultValue={typename ? { value: typename, label: typename } : null}
|
||||
options={types}
|
||||
onChange={option => {
|
||||
router.push(
|
||||
void router.push(
|
||||
`/${organization.cleanId}/${project.cleanId}/${target.cleanId}/explorer/${option.value}`,
|
||||
);
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ export const MarkAsValid: React.FC<{
|
|||
}> = ({ version }) => {
|
||||
const router = useRouteSelector();
|
||||
const [mutation, mutate] = useMutation(UpdateSchemaVersionStatusDocument);
|
||||
const markAsValid = React.useCallback(() => {
|
||||
mutate({
|
||||
const markAsValid = React.useCallback(async () => {
|
||||
await mutate({
|
||||
input: {
|
||||
organization: router.organizationId,
|
||||
project: router.projectId,
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ export const InlineCode = (props: { content: string }) => {
|
|||
<code>{props.content}</code>
|
||||
<button
|
||||
className="hover:text-orange-600 cursor-pointer p-2 pr-1 pl-2"
|
||||
onClick={ev => {
|
||||
onClick={async ev => {
|
||||
ev.preventDefault();
|
||||
window.navigator.clipboard.writeText(props.content);
|
||||
await navigator.clipboard.writeText(props.content);
|
||||
post('Copied to clipboard', 'success');
|
||||
}}
|
||||
title="Copy to clipboard"
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export const ConnectSchemaModal = ({
|
|||
return;
|
||||
}
|
||||
|
||||
mutate({
|
||||
void mutate({
|
||||
selector: {
|
||||
organization: router.organizationId,
|
||||
project: router.projectId,
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export const CreateOrganizationModal = ({
|
|||
|
||||
if (mutation.data?.createOrganization.ok) {
|
||||
toggleModalOpen();
|
||||
push(
|
||||
void push(
|
||||
`/${mutation.data.createOrganization.ok.createdOrganizationPayload.organization.cleanId}`,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export const CreateProjectModal = ({
|
|||
});
|
||||
if (data?.createProject.ok) {
|
||||
toggleModalOpen();
|
||||
push(`/${router.organizationId}/${data.createProject.ok.createdProject.cleanId}`);
|
||||
void push(`/${router.organizationId}/${data.createProject.ok.createdProject.cleanId}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export const CreateTargetModal = ({
|
|||
if (data?.createTarget.ok) {
|
||||
toggleModalOpen();
|
||||
const targetId = data.createTarget.ok.createdTarget.cleanId;
|
||||
push(`/${organizationId}/${projectId}/${targetId}`);
|
||||
void push(`/${organizationId}/${projectId}/${targetId}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export const DeleteOrganizationModal = ({
|
|||
},
|
||||
});
|
||||
toggleModalOpen();
|
||||
replace(`/${organization.cleanId}`);
|
||||
void replace(`/${organization.cleanId}`);
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export const DeleteProjectModal = ({
|
|||
},
|
||||
});
|
||||
toggleModalOpen();
|
||||
replace(`/${router.organizationId}`);
|
||||
void replace(`/${router.organizationId}`);
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export const DeleteTargetModal = ({
|
|||
},
|
||||
});
|
||||
toggleModalOpen();
|
||||
replace(`/${router.organizationId}/${router.projectId}`);
|
||||
void replace(`/${router.organizationId}/${router.projectId}`);
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export function useRouteSelector() {
|
|||
shallow?: boolean;
|
||||
},
|
||||
) => {
|
||||
router.push(route, as, options);
|
||||
void router.push(route, as, options);
|
||||
},
|
||||
[router],
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue