This file contains hidden or 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
| const reducer = (state: State, action: Actions): State => { | |
| switch (action.type) { | |
| case "increment": | |
| return { count: state.count + action.incrementStep }; | |
| case "decrement": | |
| return { count: state.count - action.decrementStep }; | |
| default: | |
| neverReached(action); | |
| } | |
| }; |
This file contains hidden or 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
| const reducer = (state: State, action: Actions): State => { | |
| switch (action.type) { | |
| case "increment": | |
| return { count: state.count + action.incrementStep }; | |
| case "decrement": | |
| return { count: state.count - action.decrementStep }; | |
| default: | |
| action; | |
| } | |
| }; |
This file contains hidden or 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
| type Increment = { | |
| type: 'increment'; | |
| incrementStep: number; | |
| }; | |
| type Decrement = { | |
| type: 'decrement'; | |
| decrementStep: number; | |
| }; | |
| type Actions = Increment | Decrement; |
This file contains hidden or 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
| app.UseEndpoints(endpoints => | |
| { | |
| endpoints.MapControllers(); | |
| endpoints.MapHub<QuestionsHub>("/questionshub"); | |
| }); |
This file contains hidden or 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
| const connection = new HubConnectionBuilder() | |
| .withUrl(`${server}/questionshub`) | |
| .withAutomaticReconnect() | |
| .build(); |
This file contains hidden or 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
| public static string GetLevel(int level) => | |
| level switch | |
| { | |
| 1 => "low", | |
| 2 => "medium", | |
| 3 => "high", | |
| _ => throw new ArgumentException("invalid level"), | |
| }; |
This file contains hidden or 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
| <PropertyGroup> | |
| ... | |
| <LangVersion>8.0</LangVersion> | |
| <Nullable>enable</Nullable> | |
| </PropertyGroup> |
This file contains hidden or 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
| var jsonContent = await response.Content.ReadAsStringAsync(); | |
| var user = JsonSerializer.Deserialize<User>(jsonContent, new JsonSerializerOptions | |
| { | |
| PropertyNameCaseInsensitive = true | |
| }); |
This file contains hidden or 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
| "dependencies": { | |
| "babel-eslint": "10.0.1", | |
| "bootstrap": "^4.1.3", | |
| "jquery": "^3.4.1", | |
| "merge": "^1.2.1", | |
| "oidc-client": "^1.9.0-beta.4", | |
| "react": "^16.0.0", | |
| "react-dom": "^16.0.0", | |
| "react-router-bootstrap": "^0.24.4", | |
| "react-router-dom": "^4.2.2", |
This file contains hidden or 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
| <Layout> | |
| <Route exact path='/' component={Home} /> | |
| <Route path='/counter' component={Counter} /> | |
| <AuthorizeRoute path='/fetch-data' component={FetchData} /> | |
| <Route path={ApplicationPaths.ApiAuthorizationPrefix} component={ApiAuthorizationRoutes} /> | |
| </Layout> |