From 93ef7ef65fb7f8ce9ae8e3eec06e9d500f560a97 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 13 Apr 2023 16:44:42 +0530 Subject: [PATCH] fix: try signup on failure Signed-off-by: Pranav C --- .../modules/test/TestResetService/index.ts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/nocodb-nest/src/modules/test/TestResetService/index.ts b/packages/nocodb-nest/src/modules/test/TestResetService/index.ts index d407a6b6a9..dc347aed46 100644 --- a/packages/nocodb-nest/src/modules/test/TestResetService/index.ts +++ b/packages/nocodb-nest/src/modules/test/TestResetService/index.ts @@ -13,12 +13,21 @@ import resetMetaSakilaSqliteProject from './resetMetaSakilaSqliteProject'; const workerStatus = {}; const loginRootUser = async () => { - const response = await axios.post( - 'http://localhost:8080/api/v1/auth/user/signin', - { email: 'user@nocodb.com', password: 'Password123.' }, - ); - - return response.data.token; + try { + const response = await axios.post( + 'http://localhost:8080/api/v1/auth/user/signin', + { email: 'user@nocodb.com', password: 'Password123.' }, + ); + + return response.data.token; + } catch (e) { + const response = await axios.post( + 'http://localhost:8080/api/v1/auth/user/signup', + { email: 'user@nocodb.com', password: 'Password123.' }, + ); + + return response.data.token; + } }; const projectTitleByType = {