-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: axios base query with retry; error handling; qr-code scan
- Loading branch information
1 parent
ab74759
commit b20cb68
Showing
8 changed files
with
67 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,11 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import { App } from './app.tsx'; | ||
import * as Sentry from '@sentry/react'; | ||
import { I18nextProvider } from 'react-i18next'; | ||
import i18n from './i18n'; | ||
import './index.scss'; | ||
import { Provider } from 'react-redux'; | ||
import { store } from '@store'; | ||
import { isElectron, setupLogging } from '@shared'; | ||
|
||
Sentry.init({ | ||
dsn: 'https://9fd06d22381ef360013d83b6b0c8375e@o4507214219313152.ingest.de.sentry.io/4507214225801296', | ||
integrations: [ | ||
Sentry.browserTracingIntegration(), | ||
Sentry.replayIntegration(), | ||
], | ||
// Performance Monitoring | ||
tracesSampleRate: 1.0, // Capture 100% of the transactions | ||
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled | ||
tracePropagationTargets: ['localhost', /^https:\/\/localhost:\d+\/api/], | ||
// Session Replay | ||
replaysSessionSampleRate: 0.1, | ||
replaysOnErrorSampleRate: 1.0, | ||
}); | ||
import { bootstrap } from '@shared/app.tsx'; | ||
|
||
if (isElectron) { | ||
setupLogging(); | ||
setupLogging().then(() => { | ||
bootstrap(); | ||
}); | ||
} else { | ||
bootstrap(); | ||
} | ||
|
||
const rootElement = document.getElementById('root') as HTMLElement; | ||
const root = ReactDOM.createRoot(rootElement); | ||
root.render( | ||
<React.StrictMode> | ||
<I18nextProvider i18n={i18n}> | ||
<Provider store={store}> | ||
<App /> | ||
</Provider> | ||
</I18nextProvider> | ||
</React.StrictMode> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as Sentry from '@sentry/react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import React from 'react'; | ||
import { I18nextProvider } from 'react-i18next'; | ||
import i18n from '@i18n'; | ||
import { Provider } from 'react-redux'; | ||
import { store } from '@store'; | ||
import { App } from '../app.tsx'; | ||
|
||
export function bootstrap() { | ||
Sentry.init({ | ||
dsn: 'https://9fd06d22381ef360013d83b6b0c8375e@o4507214219313152.ingest.de.sentry.io/4507214225801296', | ||
integrations: [ | ||
Sentry.browserTracingIntegration(), | ||
Sentry.replayIntegration(), | ||
], | ||
// Performance Monitoring | ||
tracesSampleRate: 1.0, // Capture 100% of the transactions | ||
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled | ||
tracePropagationTargets: ['localhost', /^https:\/\/localhost:\d+\/api/], | ||
// Session Replay | ||
replaysSessionSampleRate: 0.1, | ||
replaysOnErrorSampleRate: 1.0, | ||
}); | ||
|
||
const rootElement = document.getElementById('root') as HTMLElement; | ||
const root = ReactDOM.createRoot(rootElement); | ||
root.render( | ||
<React.StrictMode> | ||
<I18nextProvider i18n={i18n}> | ||
<Provider store={store}> | ||
<App /> | ||
</Provider> | ||
</I18nextProvider> | ||
</React.StrictMode> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,42 @@ | ||
import { createSlice, PayloadAction } from '@reduxjs/toolkit'; | ||
import { isElectron } from '@shared'; | ||
import { fetchConfigUrl } from '@store/thunks'; | ||
|
||
export interface ConfigState { | ||
url?: string; | ||
locked: boolean; | ||
loading: boolean; | ||
} | ||
|
||
const initialState = { | ||
url: isElectron ? '' : undefined, | ||
locked: isElectron, | ||
url: undefined, | ||
loading: true, | ||
} satisfies ConfigState as ConfigState; | ||
|
||
const configSlice = createSlice({ | ||
name: 'config', | ||
initialState, | ||
reducers: { | ||
clear(state) { | ||
if (state.locked) { | ||
return; | ||
} | ||
|
||
delete state.url; | ||
}, | ||
url(state, action: PayloadAction<string>) { | ||
if (state.locked) { | ||
return; | ||
} | ||
|
||
state.url = action.payload; | ||
}, | ||
}, | ||
extraReducers: (builder) => { | ||
// Add reducers for additional action types here, and handle loading state as needed | ||
builder.addCase(fetchConfigUrl.fulfilled, (state, action) => { | ||
if (state.locked) { | ||
return; | ||
} | ||
// Add user to the state array | ||
state.url = action.payload; | ||
}); | ||
builder | ||
.addCase(fetchConfigUrl.fulfilled, (state, action) => { | ||
// Add user to the state array | ||
state.url = action.payload; | ||
state.loading = false; | ||
}) | ||
.addCase(fetchConfigUrl.pending, (state) => { | ||
// Add user to the state array | ||
state.loading = true; | ||
}); | ||
}, | ||
}); | ||
|
||
export const { clear: clearConfig, url: setUrlConfig } = configSlice.actions; | ||
|
||
export const reducerConfig = configSlice.reducer; | ||
|
||
export const urlConfigSelector = ({ config }: { config: ConfigState }) => | ||
JSON.stringify(config); |