From 2e161a99813532edf1ff6b109fe50a8555f55d97 Mon Sep 17 00:00:00 2001 From: Kar Rui Lau Date: Tue, 3 Aug 2021 10:33:10 +0800 Subject: [PATCH] refactor: move src/types/api/auth to shared/types/form/form_auth --- .../api/auth.ts => shared/types/form/form_auth.ts | 0 shared/types/form/index.ts | 5 +++++ src/public/services/EncryptionService.ts | 2 +- src/public/services/PublicFormAuthService.ts | 6 +++--- src/public/services/UpdateFormService.ts | 10 +++++----- src/types/api/form_auth.ts | 1 + src/types/api/index.ts | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) rename src/types/api/auth.ts => shared/types/form/form_auth.ts (100%) create mode 100644 shared/types/form/index.ts create mode 100644 src/types/api/form_auth.ts diff --git a/src/types/api/auth.ts b/shared/types/form/form_auth.ts similarity index 100% rename from src/types/api/auth.ts rename to shared/types/form/form_auth.ts diff --git a/shared/types/form/index.ts b/shared/types/form/index.ts new file mode 100644 index 0000000000..63b6286f0e --- /dev/null +++ b/shared/types/form/index.ts @@ -0,0 +1,5 @@ +export * from './form' +export * from './form_auth' +export * from './form_feedback' +export * from './form_logic' +export * from './form_logo' diff --git a/src/public/services/EncryptionService.ts b/src/public/services/EncryptionService.ts index ace2ee0947..95e4d4f84a 100644 --- a/src/public/services/EncryptionService.ts +++ b/src/public/services/EncryptionService.ts @@ -1,3 +1,4 @@ +import { BasicField } from '../../../shared/types/field' import { AttachmentResponse, CheckboxResponse, @@ -19,7 +20,6 @@ import { UenResponse, YesNoResponse, } from '../../../shared/types/response' -import { BasicField } from '../../types' import { FormSgSdk } from './FormSgSdkService' diff --git a/src/public/services/PublicFormAuthService.ts b/src/public/services/PublicFormAuthService.ts index ab1eac994d..2c5d17dd1b 100644 --- a/src/public/services/PublicFormAuthService.ts +++ b/src/public/services/PublicFormAuthService.ts @@ -1,11 +1,11 @@ import axios from 'axios' -import { AuthType } from '../../types' import { + FormAuthType, PublicFormAuthLogoutDto, PublicFormAuthRedirectDto, PublicFormAuthValidateEsrvcIdDto, -} from '../../types/api' +} from '../../../shared/types/form' // Exported for testing export const PUBLIC_FORMS_ENDPOINT = '/api/v3/forms' @@ -35,7 +35,7 @@ export const validateEsrvcId = ( } export const logoutOfSpcpSession = ( - authType: AuthType, + authType: FormAuthType, ): Promise => { return axios .get( diff --git a/src/public/services/UpdateFormService.ts b/src/public/services/UpdateFormService.ts index f034a0e6dd..6f0c38fe2c 100644 --- a/src/public/services/UpdateFormService.ts +++ b/src/public/services/UpdateFormService.ts @@ -8,18 +8,18 @@ import { import { AdminFormDto, AdminFormViewDto, + EndPageUpdateDto, FormSettings, + LogicDto, + PermissionsUpdateDto, SettingsUpdateDto, -} from '../../../shared/types/form/form' -import { LogicDto } from '../../../shared/types/form/form_logic' + StartPageUpdateDto, +} from '../../../shared/types/form' import { SubmissionResponseDto } from '../../../shared/types/submission' import { EmailSubmissionDto, EncryptSubmissionDto, - EndPageUpdateDto, FormUpdateParams, - PermissionsUpdateDto, - StartPageUpdateDto, } from '../../types/api' import { createEmailSubmissionFormData } from '../utils/submission' diff --git a/src/types/api/form_auth.ts b/src/types/api/form_auth.ts new file mode 100644 index 0000000000..687ec447bc --- /dev/null +++ b/src/types/api/form_auth.ts @@ -0,0 +1 @@ +export * from '../../../shared/types/form/form_auth' diff --git a/src/types/api/index.ts b/src/types/api/index.ts index ed9b2da691..3906acaff7 100644 --- a/src/types/api/index.ts +++ b/src/types/api/index.ts @@ -1,5 +1,5 @@ export * from './core' -export * from './auth' +export * from './form_auth' export * from './field' export * from './form' export * from './billing'