Compare commits

...

3 Commits

Author SHA1 Message Date
b
0244090c6a Merge branch 'staging' into cache-checks-9-9
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 35s
2024-09-09 18:44:36 +00:00
1d1c675dd7 Merge pull request #191 from lint-0-warnings into staging
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m17s
Reviewed-on: #191
Reviewed-by: s
2024-09-09 08:55:28 +00:00
70f646444b fix: add types to rootReducer, rename userRobotImage types
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 34s
2024-09-09 10:19:37 +02:00
6 changed files with 26 additions and 9 deletions

View File

@ -8,7 +8,7 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 2", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint . --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint:fix": "eslint . --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:staged": "eslint --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint:staged": "eslint --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"formatter:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"", "formatter:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",

View File

@ -18,6 +18,10 @@ export interface RestoreState {
payload: State payload: State
} }
export interface UserLogout {
type: typeof ActionTypes.USER_LOGOUT
}
export const userLogOutAction = () => { export const userLogOutAction = () => {
return { return {
type: ActionTypes.USER_LOGOUT type: ActionTypes.USER_LOGOUT

View File

@ -1,5 +1,5 @@
import * as ActionTypes from '../actionTypes' import * as ActionTypes from '../actionTypes'
import { RestoreState } from '../actions' import { RestoreState, UserLogout } from '../actions'
export enum LoginMethods { export enum LoginMethods {
extension = 'extension', extension = 'extension',
@ -54,3 +54,4 @@ export type AuthDispatchTypes =
| UpdateKeyPair | UpdateKeyPair
| UpdateNsecBunkerPubkey | UpdateNsecBunkerPubkey
| UpdateNsecBunkerRelays | UpdateNsecBunkerRelays
| UserLogout

View File

@ -3,12 +3,15 @@ import { combineReducers } from 'redux'
import { UserAppData } from '../types' import { UserAppData } from '../types'
import * as ActionTypes from './actionTypes' import * as ActionTypes from './actionTypes'
import authReducer from './auth/reducer' import authReducer from './auth/reducer'
import { AuthState } from './auth/types' import { AuthDispatchTypes, AuthState } from './auth/types'
import metadataReducer from './metadata/reducer' import metadataReducer from './metadata/reducer'
import relaysReducer from './relays/reducer' import relaysReducer from './relays/reducer'
import { RelaysState } from './relays/types' import { RelaysDispatchTypes, RelaysState } from './relays/types'
import UserAppDataReducer from './userAppData/reducer' import UserAppDataReducer from './userAppData/reducer'
import userRobotImageReducer from './userRobotImage/reducer' import userRobotImageReducer from './userRobotImage/reducer'
import { MetadataDispatchTypes } from './metadata/types'
import { UserAppDataDispatchTypes } from './userAppData/types'
import { UserRobotImageDispatchTypes } from './userRobotImage/types'
export interface State { export interface State {
auth: AuthState auth: AuthState
@ -18,6 +21,13 @@ export interface State {
userAppData?: UserAppData userAppData?: UserAppData
} }
type AppActions =
| AuthDispatchTypes
| MetadataDispatchTypes
| UserRobotImageDispatchTypes
| RelaysDispatchTypes
| UserAppDataDispatchTypes
export const appReducer = combineReducers({ export const appReducer = combineReducers({
auth: authReducer, auth: authReducer,
metadata: metadataReducer, metadata: metadataReducer,
@ -26,8 +36,10 @@ export const appReducer = combineReducers({
userAppData: UserAppDataReducer userAppData: UserAppDataReducer
}) })
// FIXME: define types export default (
export default (state: any, action: any) => { state: ReturnType<typeof appReducer> | undefined,
action: AppActions
) => {
switch (action.type) { switch (action.type) {
case ActionTypes.USER_LOGOUT: case ActionTypes.USER_LOGOUT:
return appReducer(undefined, action) return appReducer(undefined, action)

View File

@ -1,11 +1,11 @@
import * as ActionTypes from '../actionTypes' import * as ActionTypes from '../actionTypes'
import { MetadataDispatchTypes } from './types' import { UserRobotImageDispatchTypes } from './types'
const initialState: string | null = null const initialState: string | null = null
const reducer = ( const reducer = (
state = initialState, state = initialState,
action: MetadataDispatchTypes action: UserRobotImageDispatchTypes
): string | null | undefined => { ): string | null | undefined => {
switch (action.type) { switch (action.type) {
case ActionTypes.SET_USER_ROBOT_IMAGE: case ActionTypes.SET_USER_ROBOT_IMAGE:

View File

@ -6,4 +6,4 @@ export interface SetUserRobotImage {
payload: string | null payload: string | null
} }
export type MetadataDispatchTypes = SetUserRobotImage | RestoreState export type UserRobotImageDispatchTypes = SetUserRobotImage | RestoreState