Return null from actions that return nothings (#5917)

* fix returning null

* return null from actions that return nothing
This commit is contained in:
James Gatz 2023-04-25 17:51:30 +02:00 committed by GitHub
parent 0e55e0682f
commit d73d7c3324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 0 deletions

View File

@ -53,6 +53,8 @@ export const renameProjectAction: ActionFunction = async ({
);
await models.project.update(project, { name });
return null;
};
export const deleteProjectAction: ActionFunction = async ({ params }) => {
@ -242,6 +244,8 @@ export const updateWorkspaceAction: ActionFunction = async ({ request }) => {
name,
description: description || workspace.description,
});
return null;
};
// Test Suite
@ -343,6 +347,8 @@ export const renameTestSuiteAction: ActionFunction = async ({ request, params })
invariant(unitTestSuite, 'Test Suite not found');
await models.unitTestSuite.update(unitTestSuite, { name });
return null;
};
// Unit Test
@ -362,6 +368,8 @@ expect(response1.status).to.equal(200);`,
});
trackSegmentEvent(SegmentEvent.unitTestCreate);
return null;
};
export const deleteTestAction: ActionFunction = async ({ params }) => {
@ -376,6 +384,8 @@ export const deleteTestAction: ActionFunction = async ({ params }) => {
await models.unitTest.remove(unitTest);
trackSegmentEvent(SegmentEvent.unitTestDelete);
return null;
};
export const updateTestAction: ActionFunction = async ({ request, params }) => {
@ -398,6 +408,8 @@ export const updateTestAction: ActionFunction = async ({ request, params }) => {
invariant(unitTest, 'Test not found');
await models.unitTest.update(unitTest, { name, code, requestId: requestId || null });
return null;
};
export const runTestAction: ActionFunction = async ({ params }) => {
@ -459,6 +471,8 @@ export const updateApiSpecAction: ActionFunction = async ({
created: fromSync ? Date.now() : apiSpec.created,
contents,
}, fromSync);
return null;
};
export const generateCollectionFromApiSpecAction: ActionFunction = async ({

View File

@ -556,6 +556,8 @@ export const updateGitRepoAction: ActionFunction = async ({
await models.workspaceMeta.updateByParentId(workspaceId, {
gitRepositoryId,
});
return null;
};
export const resetGitRepoAction: ActionFunction = async ({
@ -590,6 +592,8 @@ export const resetGitRepoAction: ActionFunction = async ({
await models.gitRepository.remove(repo);
await database.flushChanges(flushId);
return null;
};
export interface CommitToGitRepoResult {

View File

@ -38,6 +38,8 @@ export const pullRemoteCollectionAction: ActionFunction = async ({ request }) =>
await newVCS.removeBackendProjectsForRoot(backendProject.rootDocumentId);
await pullBackendProject({ vcs: newVCS, backendProject, remoteProjects });
return null;
};
export interface RemoteCollectionsLoaderData {