staging #223
@ -8,7 +8,7 @@ const initialState: AuthState = {
|
|||||||
const reducer = (
|
const reducer = (
|
||||||
state = initialState,
|
state = initialState,
|
||||||
action: AuthDispatchTypes
|
action: AuthDispatchTypes
|
||||||
): AuthState | null => {
|
): AuthState => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ActionTypes.SET_AUTH_STATE: {
|
case ActionTypes.SET_AUTH_STATE: {
|
||||||
const { loginMethod, nostrLoginAuthMethod, keyPair } = state
|
const { loginMethod, nostrLoginAuthMethod, keyPair } = state
|
||||||
@ -48,7 +48,7 @@ const reducer = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ActionTypes.RESTORE_STATE:
|
case ActionTypes.RESTORE_STATE:
|
||||||
return action.payload.auth
|
return action.payload.auth || initialState
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state
|
return state
|
||||||
|
@ -2,15 +2,7 @@ import * as ActionTypes from '../actionTypes'
|
|||||||
import { MetadataDispatchTypes } from './types'
|
import { MetadataDispatchTypes } from './types'
|
||||||
import { Event } from 'nostr-tools'
|
import { Event } from 'nostr-tools'
|
||||||
|
|
||||||
const initialState: Event = {
|
const initialState: Event | null = null
|
||||||
content: '',
|
|
||||||
created_at: 0,
|
|
||||||
id: '',
|
|
||||||
kind: 0,
|
|
||||||
pubkey: '',
|
|
||||||
sig: '',
|
|
||||||
tags: []
|
|
||||||
}
|
|
||||||
|
|
||||||
const reducer = (
|
const reducer = (
|
||||||
state = initialState,
|
state = initialState,
|
||||||
@ -23,7 +15,7 @@ const reducer = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ActionTypes.RESTORE_STATE:
|
case ActionTypes.RESTORE_STATE:
|
||||||
return action.payload.metadata || null
|
return action.payload.metadata || initialState
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state
|
return state
|
||||||
|
@ -10,7 +10,7 @@ const initialState: RelaysState = {
|
|||||||
const reducer = (
|
const reducer = (
|
||||||
state = initialState,
|
state = initialState,
|
||||||
action: RelaysDispatchTypes
|
action: RelaysDispatchTypes
|
||||||
): RelaysState | null => {
|
): RelaysState => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ActionTypes.SET_RELAY_MAP:
|
case ActionTypes.SET_RELAY_MAP:
|
||||||
return { ...state, map: action.payload, mapUpdated: Date.now() }
|
return { ...state, map: action.payload, mapUpdated: Date.now() }
|
||||||
@ -25,7 +25,7 @@ const reducer = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ActionTypes.RESTORE_STATE:
|
case ActionTypes.RESTORE_STATE:
|
||||||
return action.payload.relays
|
return action.payload.relays || initialState
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state
|
return state
|
||||||
|
@ -12,7 +12,7 @@ const reducer = (
|
|||||||
return action.payload
|
return action.payload
|
||||||
|
|
||||||
case ActionTypes.RESTORE_STATE:
|
case ActionTypes.RESTORE_STATE:
|
||||||
return action.payload.userRobotImage
|
return action.payload.userRobotImage || initialState
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state
|
return state
|
||||||
|
Loading…
Reference in New Issue
Block a user