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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
{ | |
"AWSCognito": { | |
"Region": "{Region}", | |
"PoolId": "{PoolId}", | |
"AppClientId": "{AppClientId}" | |
} | |
} |
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
... | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
var Region = Configuration["AWSCognito:Region"]; | |
var PoolId = Configuration["AWSCognito:PoolId"]; | |
var AppClientId = Configuration["AWSCognito:AppClientId"]; | |
services | |
.AddAuthentication(options => | |
{ |
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
... | |
using Microsoft.AspNetCore.Authorization; | |
... | |
// This authorize attribute will be applied to all routes in this controller | |
[Authorize] | |
[Route("api/[controller]")] | |
[ApiController] |
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
... | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
... | |
services | |
.AddAuthorization(options => | |
{ | |
options.AddPolicy("Admin", policy => policy.RequireClaim("custom:groupId", new List<string> { "0" } )); |
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
... | |
using Microsoft.AspNetCore.Authorization; | |
... | |
[Authorize] | |
[Route("api/[controller]")] | |
[ApiController] | |
public class ClapsController : ControllerBase |
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
import React from 'react' | |
import { render } from 'react-dom' | |
import App from './components/App' | |
import { defaults } from 'react-sweet-state' | |
import { produce } from 'immer' | |
defaults.mutator = (currentState, producer) => produce(currentState, producer) | |
render( |
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
import { createStore } from 'react-sweet-state' | |
import actions from './todos.actions' | |
const initialState = [] | |
const todosStore = createStore({ initialState, actions }) | |
export default todosStore |
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
let nextTodoId = 0 | |
const todosActions = { | |
addTodo: text => ({ setState }) => { | |
setState(todos => { | |
todos.push({ | |
id: nextTodoId++, | |
text, | |
completed: false | |
}) |
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
import makeSelectorsIntoHooks from '../utils' | |
import todosStore from './todos.store' | |
import { VisibilityFilters } from '../visibilityFilter/visibilityFilter.store' | |
const todoSelectors = { | |
useTodosActions: null, | |
useVisibleTodos: (todos, visibilityFilter) => { | |
switch (visibilityFilter) { | |
case VisibilityFilters.SHOW_ALL: |
OlderNewer