11import React , { CSSProperties , useMemo } from 'react' ;
22import { observer } from 'mobx-react-lite' ;
33import { BalanceMode , Unit } from 'util/constants' ;
4+ import { AuthenticationError } from 'util/errors' ;
45import { sampleApiResponses } from 'util/tests/sampleData' ;
56import { createStore , StoreProvider } from 'store' ;
67import { PersistentSettings } from 'store/stores/settingsStore' ;
@@ -9,7 +10,10 @@ import { ThemeProvider } from 'components/theme';
910
1011// mock the GRPC client to return sample data instead of making an actual request
1112const grpc = {
12- request : ( methodDescriptor : any ) => {
13+ request : ( methodDescriptor : any , opts : any , metadata : any ) => {
14+ // fail any authenticated requests to simulate incorrect login attempts
15+ if ( metadata && metadata . authorization ) throw new AuthenticationError ( ) ;
16+
1317 const endpoint = `${ methodDescriptor . service . serviceName } .${ methodDescriptor . methodName } ` ;
1418 const data = sampleApiResponses [ endpoint ] || { } ;
1519 // the calling function expects the return value to have a `toObject` function
@@ -32,7 +36,11 @@ class StoryAppStorage {
3236
3337// Create a store that pulls data from the mock GRPC and doesn't use
3438// the real localStorage to save settings
35- const createStoryStore = ( ) => createStore ( grpc , new StoryAppStorage ( ) ) ;
39+ const createStoryStore = ( ) => {
40+ const store = createStore ( grpc , new StoryAppStorage ( ) ) ;
41+ store . fetchAllData ( ) ;
42+ return store ;
43+ } ;
3644
3745/**
3846 * This component is used to wrap every story. It provides the app theme
0 commit comments