diff --git a/web/src/app/actions/auth.js b/web/src/app/actions/auth.ts similarity index 85% rename from web/src/app/actions/auth.js rename to web/src/app/actions/auth.ts index 79d2396341..6c9f776665 100644 --- a/web/src/app/actions/auth.js +++ b/web/src/app/actions/auth.ts @@ -8,7 +8,9 @@ export const AUTH_LOGOUT = 'AUTH_LOGOUT' // the current session will be first made to the backend. // // AUTH_LOGOUT will be dispatched if, and after, the request completes. -export function authLogout(performFetch = false) { +export function authLogout( + performFetch = false, +): { type: string } | (() => Promise) { const payload = { type: AUTH_LOGOUT } if (!performFetch) return payload return () => diff --git a/web/src/app/actions/hooks.ts b/web/src/app/actions/hooks.ts index e296961a6f..99e3bde1a6 100644 --- a/web/src/app/actions/hooks.ts +++ b/web/src/app/actions/hooks.ts @@ -21,7 +21,7 @@ export function sanitizeURLParam(value: Value): string | string[] { case 'string': return value.trim() case 'boolean': - if (value === true) return '1' + if (value) return '1' return '' case 'number': return value.toString() @@ -48,10 +48,8 @@ export function getParamValues>( result[name] = q.get(name) === '1' } else if (typeof defaultVal === 'string') { result[name] = q.get(name) || '' - } else if (typeof defaultVal === 'number') { - result[name] = +(q.get(name) as string) } else { - result[name] = defaultVal + result[name] = +(q.get(name) as string) } } return result as T diff --git a/web/src/app/actions/index.js b/web/src/app/actions/index.js deleted file mode 100644 index 976bf07bc2..0000000000 --- a/web/src/app/actions/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from './main' -export * from './auth' -export * from './hooks' diff --git a/web/src/app/actions/index.ts b/web/src/app/actions/index.ts new file mode 100644 index 0000000000..2d6d1b0641 --- /dev/null +++ b/web/src/app/actions/index.ts @@ -0,0 +1,4 @@ +export * from './auth' +export * from './hooks' + +export const SET_SHOW_NEW_USER_FORM = 'SET_SHOW_NEW_USER_FORM' diff --git a/web/src/app/actions/main.js b/web/src/app/actions/main.js deleted file mode 100644 index 523659153e..0000000000 --- a/web/src/app/actions/main.js +++ /dev/null @@ -1,8 +0,0 @@ -export const SET_SHOW_NEW_USER_FORM = 'SET_SHOW_NEW_USER_FORM' - -export function setShowNewUserForm(search) { - return { - type: SET_SHOW_NEW_USER_FORM, - payload: search, - } -}