This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
export type ActionType = string;
|
||||
|
||||
import type {Article} from '../../types/article';
|
||||
import type { LiveBoard } from '../../types/liveboard';
|
||||
import type { DepartureType } from '../../types/liveboard';
|
||||
import type {WeatherData} from '../../types/weather';
|
||||
import {
|
||||
loadTrainSchedule,
|
||||
@@ -25,7 +25,7 @@ export type LoadTrainSchedule = {
|
||||
|
||||
export type LoadTrainScheduleSuccess = {
|
||||
type: typeof loadTrainScheduleSuccess,
|
||||
liveboard: LiveBoard
|
||||
departures: DepartureType[]
|
||||
}
|
||||
|
||||
export type LoadTrainScheduleError = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { type State } from "./state";
|
||||
|
||||
export const initialState: State = {
|
||||
liveboard: undefined,
|
||||
departures: undefined,
|
||||
trainScheduleError: undefined,
|
||||
trainScheduleLoading: false,
|
||||
news: undefined,
|
||||
|
||||
@@ -33,7 +33,7 @@ export const reducerInner = (state: State, action: Action): State => {
|
||||
else if(action.type === loadTrainScheduleSuccess) {
|
||||
return {
|
||||
...state,
|
||||
liveboard: (action as LoadTrainScheduleSuccess).liveboard,
|
||||
departures: (action as LoadTrainScheduleSuccess).departures,
|
||||
trainScheduleLoading: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Article } from "../types/article";
|
||||
import type { LiveBoard } from "../types/liveboard";
|
||||
import type { DepartureType } from "../types/liveboard";
|
||||
import type { WeatherData } from "../types/weather";
|
||||
|
||||
export type State = {
|
||||
trainScheduleLoading: boolean,
|
||||
liveboard: LiveBoard | undefined,
|
||||
departures: DepartureType[] | undefined,
|
||||
trainScheduleError: Error | undefined,
|
||||
|
||||
weather: WeatherData | undefined,
|
||||
|
||||
Reference in New Issue
Block a user