├── README.md ├── react-ui-crud ├── src │ ├── constants │ │ └── index.js │ ├── App.test.js │ ├── App.js │ ├── index.css │ ├── index.js │ ├── components │ │ ├── AppFooter.js │ │ ├── Home.js │ │ ├── form │ │ │ ├── RegistrationModal.js │ │ │ └── RegistrationForm.js │ │ ├── AppHeader.js │ │ └── DataTable.js │ ├── App.css │ ├── logo.svg │ └── serviceWorker.js ├── public │ ├── favicon.ico │ ├── manifest.json │ └── index.html ├── .gitignore ├── package.json └── README.md └── ReactASPCrud ├── ReactASPCrud ├── obj │ ├── Debug │ │ └── netcoreapp2.1 │ │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs │ │ │ ├── ReactASPCrud.AssemblyInfoInputs.cache │ │ │ ├── ReactASPCrud.RazorAssemblyInfo.cache │ │ │ ├── ReactASPCrud.RazorTargetAssemblyInfo.cache │ │ │ ├── ReactASPCrud.csproj.CoreCompileInputs.cache │ │ │ ├── ReactASPCrud.dll │ │ │ ├── ReactASPCrud.pdb │ │ │ ├── ReactASPCrud.assets.cache │ │ │ ├── ReactASPCrud.csprojAssemblyReference.cache │ │ │ ├── ReactASPCrud.RazorAssemblyInfo.cs │ │ │ ├── ReactASPCrud.AssemblyInfo.cs │ │ │ └── ReactASPCrud.csproj.FileListAbsolute.txt │ ├── ReactASPCrud.csproj.nuget.cache │ ├── ReactASPCrud.csproj.nuget.g.targets │ └── ReactASPCrud.csproj.nuget.g.props ├── gitignore.txt ├── appsettings.json ├── bin │ └── Debug │ │ └── netcoreapp2.1 │ │ ├── ReactASPCrud.dll │ │ ├── ReactASPCrud.pdb │ │ ├── ReactASPCrud.runtimeconfig.dev.json │ │ └── ReactASPCrud.runtimeconfig.json ├── appsettings.Development.json ├── Models │ └── User.cs ├── ReactASPCrud.csproj.user ├── ReactASPCrud.csproj ├── Program.cs ├── Properties │ └── launchSettings.json ├── Startup.cs ├── Controllers │ └── UsersController.cs └── Services │ └── UserService.cs └── ReactASPCrud.sln /README.md: -------------------------------------------------------------------------------- 1 | # ReactASPNET 2 | A brief intro to React and ASP.NET API 3 | -------------------------------------------------------------------------------- /react-ui-crud/src/constants/index.js: -------------------------------------------------------------------------------- 1 | export const USERS_API_URL = 'https://localhost:5001/api/users'; -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /react-ui-crud/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamjuliosampaio/ReactASPNET/HEAD/react-ui-crud/public/favicon.ico -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | eb29135277df91d282ad709bba72e0ad6dae3cf0 2 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.RazorAssemblyInfo.cache: -------------------------------------------------------------------------------- 1 | ce93d693504c39b33853cbb8b88ac340d1ddaa57 2 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.RazorTargetAssemblyInfo.cache: -------------------------------------------------------------------------------- 1 | 3aad3f2e68c8b6c6d39f1035f976abbc98ae0195 2 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 623d18e71a6fa2ddb7095bed7f744b016e99fc23 2 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/gitignore.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamjuliosampaio/ReactASPNET/HEAD/ReactASPCrud/ReactASPCrud/gitignore.txt -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/bin/Debug/netcoreapp2.1/ReactASPCrud.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamjuliosampaio/ReactASPNET/HEAD/ReactASPCrud/ReactASPCrud/bin/Debug/netcoreapp2.1/ReactASPCrud.dll -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/bin/Debug/netcoreapp2.1/ReactASPCrud.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamjuliosampaio/ReactASPNET/HEAD/ReactASPCrud/ReactASPCrud/bin/Debug/netcoreapp2.1/ReactASPCrud.pdb -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamjuliosampaio/ReactASPNET/HEAD/ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.dll -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamjuliosampaio/ReactASPNET/HEAD/ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.pdb -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamjuliosampaio/ReactASPNET/HEAD/ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.assets.cache -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/ReactASPCrud.csproj.nuget.cache: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "dgSpecHash": "Xliks37obh9B4A4j35dHP0G16vVGbJ6/o3ZeqLEP9+84WBEJ+JgbjF967EDAAn/CNy1bV7ZTmifcjU3hJx4Hrg==", 4 | "success": true 5 | } -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamjuliosampaio/ReactASPNET/HEAD/ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /react-ui-crud/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/bin/Debug/netcoreapp2.1/ReactASPCrud.runtimeconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "additionalProbingPaths": [ 4 | "C:\\Users\\Diogo\\.dotnet\\store\\|arch|\\|tfm|", 5 | "C:\\Users\\Diogo\\.nuget\\packages", 6 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/bin/Debug/netcoreapp2.1/ReactASPCrud.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "tfm": "netcoreapp2.1", 4 | "framework": { 5 | "name": "Microsoft.AspNetCore.App", 6 | "version": "2.1.1" 7 | }, 8 | "configProperties": { 9 | "System.GC.Server": true 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/Models/User.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ReactASPCrud.Models 4 | { 5 | public class User 6 | { 7 | public int Id { get; set; } 8 | public string Name { get; set; } 9 | public string Email { get; set; } 10 | public string Document { get; set; } 11 | public string Phone { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /react-ui-crud/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /react-ui-crud/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /react-ui-crud/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | import AppHeader from './components/AppHeader'; 3 | import Home from './components/Home'; 4 | import AppFooter from './components/AppFooter'; 5 | 6 | class App extends Component { 7 | 8 | render() { 9 | return 10 | 11 | 12 | 13 | ; 14 | } 15 | } 16 | 17 | export default App; 18 | -------------------------------------------------------------------------------- /react-ui-crud/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/ReactASPCrud.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ProjectDebugger 5 | 6 | 7 | ReactASPCrud 8 | 9 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/ReactASPCrud.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /react-ui-crud/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import 'bootstrap/dist/css/bootstrap.min.css'; 5 | import App from './App'; 6 | import * as serviceWorker from './serviceWorker'; 7 | 8 | ReactDOM.render(, document.getElementById('root')); 9 | 10 | // If you want your app to work offline and load faster, you can change 11 | // unregister() to register() below. Note this comes with some pitfalls. 12 | // Learn more about service workers: https://bit.ly/CRA-PWA 13 | serviceWorker.unregister(); 14 | -------------------------------------------------------------------------------- /react-ui-crud/src/components/AppFooter.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from 'react'; 2 | 3 | class AppFooter extends React.Component { 4 | 5 | render() { 6 | return 7 |
8 | 9 | 13 |
; 14 | } 15 | } 16 | 17 | export default AppFooter; -------------------------------------------------------------------------------- /react-ui-crud/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 40vmin; 8 | pointer-events: none; 9 | } 10 | 11 | .App-header { 12 | background-color: #282c34; 13 | min-height: 100vh; 14 | display: flex; 15 | flex-direction: column; 16 | align-items: center; 17 | justify-content: center; 18 | font-size: calc(10px + 2vmin); 19 | color: white; 20 | } 21 | 22 | .App-link { 23 | color: #61dafb; 24 | } 25 | 26 | @keyframes App-logo-spin { 27 | from { 28 | transform: rotate(0deg); 29 | } 30 | to { 31 | transform: rotate(360deg); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace ReactASPCrud 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /react-ui-crud/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-ui-crud", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "bootstrap": "^4.3.1", 7 | "react": "^16.8.6", 8 | "react-dom": "^16.8.6", 9 | "react-scripts": "3.0.1", 10 | "reactstrap": "^8.0.1" 11 | }, 12 | "scripts": { 13 | "start": "react-scripts start", 14 | "build": "react-scripts build", 15 | "test": "react-scripts test", 16 | "eject": "react-scripts eject" 17 | }, 18 | "eslintConfig": { 19 | "extends": "react-app" 20 | }, 21 | "browserslist": { 22 | "production": [ 23 | ">0.2%", 24 | "not dead", 25 | "not op_mini all" 26 | ], 27 | "development": [ 28 | "last 1 chrome version", 29 | "last 1 firefox version", 30 | "last 1 safari version" 31 | ] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:56608", 8 | "sslPort": 44362 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "api/users", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "ReactASPCrud": { 21 | "commandName": "Project", 22 | "launchBrowser": true, 23 | "launchUrl": "api/users", 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.RazorAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.RelatedAssemblyAttribute("ReactASPCrud.Views")] 15 | [assembly: Microsoft.AspNetCore.Razor.Hosting.RazorLanguageVersionAttribute("2.1")] 16 | [assembly: Microsoft.AspNetCore.Razor.Hosting.RazorConfigurationNameAttribute("MVC-2.1")] 17 | [assembly: Microsoft.AspNetCore.Razor.Hosting.RazorExtensionAssemblyNameAttribute("MVC-2.1", "Microsoft.AspNetCore.Mvc.Razor.Extensions")] 18 | 19 | // Generated by the MSBuild WriteCodeFragment class. 20 | 21 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("ReactASPCrud")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 16 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 17 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 18 | [assembly: System.Reflection.AssemblyProductAttribute("ReactASPCrud")] 19 | [assembly: System.Reflection.AssemblyTitleAttribute("ReactASPCrud")] 20 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 21 | 22 | // Generated by the MSBuild WriteCodeFragment class. 23 | 24 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactASPCrud", "ReactASPCrud\ReactASPCrud.csproj", "{46A182E1-1DA6-4986-AF04-C0C31279FF83}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {46A182E1-1DA6-4986-AF04-C0C31279FF83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {46A182E1-1DA6-4986-AF04-C0C31279FF83}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {46A182E1-1DA6-4986-AF04-C0C31279FF83}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {46A182E1-1DA6-4986-AF04-C0C31279FF83}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {22C194AC-7420-4731-B75C-73F2E8ADA116} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/Debug/netcoreapp2.1/ReactASPCrud.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\bin\Debug\netcoreapp2.1\ReactASPCrud.deps.json 2 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\bin\Debug\netcoreapp2.1\ReactASPCrud.runtimeconfig.json 3 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\bin\Debug\netcoreapp2.1\ReactASPCrud.runtimeconfig.dev.json 4 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\bin\Debug\netcoreapp2.1\ReactASPCrud.dll 5 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\bin\Debug\netcoreapp2.1\ReactASPCrud.pdb 6 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\Debug\netcoreapp2.1\ReactASPCrud.csprojAssemblyReference.cache 7 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\Debug\netcoreapp2.1\ReactASPCrud.csproj.CoreCompileInputs.cache 8 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\Debug\netcoreapp2.1\ReactASPCrud.RazorAssemblyInfo.cache 9 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\Debug\netcoreapp2.1\ReactASPCrud.RazorAssemblyInfo.cs 10 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\Debug\netcoreapp2.1\ReactASPCrud.AssemblyInfoInputs.cache 11 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\Debug\netcoreapp2.1\ReactASPCrud.AssemblyInfo.cs 12 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\Debug\netcoreapp2.1\ReactASPCrud.RazorTargetAssemblyInfo.cache 13 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\Debug\netcoreapp2.1\ReactASPCrud.dll 14 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\Debug\netcoreapp2.1\ReactASPCrud.pdb 15 | -------------------------------------------------------------------------------- /react-ui-crud/src/components/Home.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Col, Container, Row } from 'reactstrap'; 3 | import DataTable from './DataTable'; 4 | import RegistrationModal from './form/RegistrationModal'; 5 | 6 | import { USERS_API_URL } from '../constants'; 7 | 8 | class Home extends Component { 9 | 10 | state = { 11 | items: [] 12 | } 13 | 14 | componentDidMount() { 15 | this.getItens(); 16 | } 17 | 18 | getItens = () => { 19 | fetch(USERS_API_URL) 20 | .then(res => res.json()) 21 | .then(res => this.setState({ items: res })) 22 | .catch(err => console.log(err)); 23 | } 24 | 25 | addUserToState = user => { 26 | this.setState(previous => ({ 27 | items: [...previous.items, user] 28 | })); 29 | } 30 | 31 | updateState = (id) => { 32 | this.getItens(); 33 | } 34 | 35 | deleteItemFromState = id => { 36 | const updated = this.state.items.filter(item => item.id !== id); 37 | this.setState({ items: updated }) 38 | } 39 | 40 | render() { 41 | return 42 | 43 | 44 |

My First React + ASP.NET CRUD React

45 | 46 |
47 | 48 | 49 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
; 61 | } 62 | } 63 | 64 | export default Home; 65 | -------------------------------------------------------------------------------- /react-ui-crud/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 22 | React App 23 | 24 | 25 | 26 |
27 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /react-ui-crud/src/components/form/RegistrationModal.js: -------------------------------------------------------------------------------- 1 | import React, { Component, Fragment } from 'react'; 2 | import { Button, Modal, ModalHeader, ModalBody } from 'reactstrap'; 3 | import RegistrationForm from './RegistrationForm'; 4 | 5 | class RegistrationModal extends Component { 6 | 7 | state = { 8 | modal: false 9 | } 10 | 11 | toggle = () => { 12 | this.setState(previous => ({ 13 | modal: !previous.modal 14 | })); 15 | } 16 | 17 | render() { 18 | const isNew = this.props.isNew; 19 | 20 | let title = 'Edit User'; 21 | let button = ''; 22 | if (isNew) { 23 | title = 'Add User'; 24 | 25 | button = ; 29 | } else { 30 | button = ; 33 | } 34 | 35 | return 36 | {button} 37 | 38 | {title} 39 | 40 | 41 | 46 | 47 | 48 | ; 49 | } 50 | } 51 | 52 | export default RegistrationModal; -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.Extensions.Configuration; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using ReactASPCrud.Services; 7 | 8 | namespace ReactASPCrud 9 | { 10 | public class Startup 11 | { 12 | public Startup(IConfiguration configuration) 13 | { 14 | Configuration = configuration; 15 | } 16 | 17 | public IConfiguration Configuration { get; } 18 | 19 | // This method gets called by the runtime. Use this method to add services to the container. 20 | public void ConfigureServices(IServiceCollection services) 21 | { 22 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); 23 | services.AddSingleton(); 24 | 25 | services.AddCors(o => o.AddPolicy("ReactPolicy", builder => 26 | { 27 | builder.AllowAnyOrigin() 28 | .AllowAnyMethod() 29 | .AllowAnyHeader() 30 | .AllowCredentials(); 31 | })); 32 | } 33 | 34 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 35 | public void Configure(IApplicationBuilder app, IHostingEnvironment env) 36 | { 37 | if (env.IsDevelopment()) 38 | { 39 | app.UseDeveloperExceptionPage(); 40 | } 41 | else 42 | { 43 | app.UseHsts(); 44 | } 45 | 46 | app.UseHttpsRedirection(); 47 | app.UseMvc(); 48 | app.UseCors("ReactPolicy"); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /react-ui-crud/src/components/AppHeader.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | Navbar, 4 | NavbarBrand, 5 | NavbarToggler, 6 | Collapse, 7 | Nav, 8 | NavItem, 9 | NavLink, 10 | UncontrolledDropdown, 11 | DropdownToggle, 12 | DropdownMenu, 13 | DropdownItem 14 | } from 'reactstrap'; 15 | 16 | class AppHeader extends Component { 17 | 18 | state = { 19 | isOpen: false 20 | }; 21 | toggle = this.toggle.bind(this); 22 | 23 | toggle() { 24 | this.setState({ 25 | isOpen: !this.state.isOpen 26 | }) 27 | } 28 | 29 | render() { 30 | return 31 | 32 | 33 | 34 | 35 | 36 | 50 | 51 | ; 52 | } 53 | } 54 | 55 | export default AppHeader; -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/Controllers/UsersController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNetCore.Cors; 4 | using Microsoft.AspNetCore.Mvc; 5 | using ReactASPCrud.Models; 6 | using ReactASPCrud.Services; 7 | 8 | namespace ReactASPCrud.Controllers 9 | { 10 | [Produces("application/json")] 11 | [Route("api/[controller]")] 12 | [ApiController] 13 | [EnableCors("ReactPolicy")] 14 | public class UsersController : ControllerBase 15 | { 16 | private readonly UserService userService; 17 | 18 | public UsersController(UserService userService) 19 | { 20 | this.userService = userService; 21 | } 22 | 23 | // GET api/users 24 | [HttpGet] 25 | public IEnumerable Get() 26 | { 27 | return userService.GetAll(); 28 | } 29 | 30 | // GET api/users/5 31 | [HttpGet("{id}")] 32 | public async Task Get(int id) 33 | { 34 | return Ok(userService.GetById(id)); 35 | } 36 | 37 | // POST api/users 38 | [HttpPost] 39 | public async Task Post([FromBody] User user) 40 | { 41 | return CreatedAtAction("Get", new { id = user.Id }, userService.Create(user)); 42 | } 43 | 44 | // PUT api/users/5 45 | [HttpPut("{id}")] 46 | public async Task Put(int id, [FromBody] User user) 47 | { 48 | userService.Update(id, user); 49 | 50 | return NoContent(); 51 | } 52 | 53 | // DELETE api/users/5 54 | [HttpDelete("{id}")] 55 | public async Task Delete(int id) 56 | { 57 | userService.Delete(id); 58 | 59 | return NoContent(); 60 | } 61 | 62 | public override NoContentResult NoContent() 63 | { 64 | return base.NoContent(); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /react-ui-crud/src/components/DataTable.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Table, Button } from 'reactstrap'; 3 | import RegistrationModal from './form/RegistrationModal'; 4 | 5 | import { USERS_API_URL } from '../constants'; 6 | 7 | class DataTable extends Component { 8 | 9 | deleteItem = id => { 10 | let confirmDeletion = window.confirm('Do you really wish to delete it?'); 11 | if (confirmDeletion) { 12 | fetch(`${USERS_API_URL}/${id}`, { 13 | method: 'delete', 14 | headers: { 15 | 'Content-Type': 'application/json' 16 | } 17 | }) 18 | .then(res => { 19 | this.props.deleteItemFromState(id); 20 | }) 21 | .catch(err => console.log(err)); 22 | } 23 | } 24 | 25 | render() { 26 | const items = this.props.items; 27 | return 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | {!items || items.length <= 0 ? 40 | 41 | 42 | 43 | : items.map(item => ( 44 | 45 | 48 | 51 | 54 | 57 | 60 | 70 | 71 | ))} 72 | 73 |
IdNameEmailDocumentPhoneActions
No Users yet
46 | {item.id} 47 | 49 | {item.name} 50 | 52 | {item.email} 53 | 55 | {item.document} 56 | 58 | {item.phone} 59 | 61 |
62 | 66 |     67 | 68 |
69 |
; 74 | } 75 | } 76 | 77 | export default DataTable; 78 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/Services/UserService.cs: -------------------------------------------------------------------------------- 1 | using ReactASPCrud.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace ReactASPCrud.Services 7 | { 8 | public class UserService 9 | { 10 | private static List users = new List(); 11 | private static int Count = 1; 12 | 13 | private static readonly string[] names = new string[] { "Jonathan", "Mary", "Susan", "Joe", "Paul", "Carl", "Amanda", "Neil" }; 14 | private static readonly string[] surnames = new string[] { "Smith", "O'Neil", "MacDonald", "Gay", "Bailee", "Saigan", "Strip", "Spenser" }; 15 | private static readonly string[] extensions = new string[] { "@gmail.com", "@hotmail.com", "@outlook.com", "@icloud.com", "@yahoo.com" }; 16 | 17 | static UserService() 18 | { 19 | Random rnd = new Random(); 20 | for (int i = 0; i < 5; i++) 21 | { 22 | string currName = names[rnd.Next(names.Length)]; 23 | User user = new User 24 | { 25 | Id = Count++, 26 | Name = currName + " " + surnames[rnd.Next(surnames.Length)], 27 | Email = currName.ToLower() + extensions[rnd.Next(extensions.Length)], 28 | Document = (rnd.Next(0, 100000) * rnd.Next(0, 100000)).ToString().PadLeft(10, '0'), 29 | Phone = "+1 888-452-1232" 30 | }; 31 | 32 | users.Add(user); 33 | } 34 | } 35 | 36 | public List GetAll() 37 | { 38 | return users; 39 | } 40 | 41 | public User GetById(int id) 42 | { 43 | return users.Where(user => user.Id == id).FirstOrDefault(); 44 | } 45 | 46 | public User Create(User user) 47 | { 48 | user.Id = Count++; 49 | users.Add(user); 50 | 51 | return user; 52 | } 53 | 54 | public void Update(int id, User user) 55 | { 56 | User found = users.Where(n => n.Id == id).FirstOrDefault(); 57 | found.Name = user.Name; 58 | found.Email = user.Email; 59 | found.Document = user.Document; 60 | found.Phone = user.Phone; 61 | } 62 | 63 | public void Delete(int id) 64 | { 65 | users.RemoveAll(n => n.Id == id); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /react-ui-crud/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/ReactASPCrud.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /react-ui-crud/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `npm run build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /react-ui-crud/src/components/form/RegistrationForm.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button, Form, FormGroup, Input, Label } from 'reactstrap'; 3 | 4 | import { USERS_API_URL } from '../../constants'; 5 | 6 | class RegistrationForm extends React.Component { 7 | 8 | state = { 9 | id: 0, 10 | name: '', 11 | document: '', 12 | email: '', 13 | phone: '' 14 | } 15 | 16 | componentDidMount() { 17 | if (this.props.user) { 18 | const { id, name, document, email, phone } = this.props.user 19 | this.setState({ id, name, document, email, phone}); 20 | } 21 | } 22 | 23 | onChange = e => { 24 | this.setState({ [e.target.name]: e.target.value }) 25 | } 26 | 27 | submitNew = e => { 28 | e.preventDefault(); 29 | fetch(`${USERS_API_URL}`, { 30 | method: 'post', 31 | headers: { 32 | 'Content-Type': 'application/json' 33 | }, 34 | body: JSON.stringify({ 35 | name: this.state.name, 36 | document: this.state.document, 37 | email: this.state.email, 38 | phone: this.state.phone 39 | }) 40 | }) 41 | .then(res => res.json()) 42 | .then(user => { 43 | this.props.addUserToState(user); 44 | this.props.toggle(); 45 | }) 46 | .catch(err => console.log(err)); 47 | } 48 | 49 | submitEdit = e => { 50 | e.preventDefault(); 51 | fetch(`${USERS_API_URL}/${this.state.id}`, { 52 | method: 'put', 53 | headers: { 54 | 'Content-Type': 'application/json' 55 | }, 56 | body: JSON.stringify({ 57 | name: this.state.name, 58 | document: this.state.document, 59 | email: this.state.email, 60 | phone: this.state.phone 61 | }) 62 | }) 63 | .then(() => { 64 | this.props.toggle(); 65 | this.props.updateUserIntoState(this.state.id); 66 | }) 67 | .catch(err => console.log(err)); 68 | } 69 | 70 | render() { 71 | return
72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 88 | 89 | 90 |
; 91 | } 92 | } 93 | 94 | export default RegistrationForm; -------------------------------------------------------------------------------- /ReactASPCrud/ReactASPCrud/obj/ReactASPCrud.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | C:\simpletalk\ReactTutorial\ReactASPCrud\ReactASPCrud\obj\project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\Diogo\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder 9 | PackageReference 10 | 4.9.0 11 | 12 | 13 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.entityframeworkcore.tools\2.1.1 26 | C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.analyzers\1.1.0 27 | C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.razor.design\2.1.2 28 | 29 | -------------------------------------------------------------------------------- /react-ui-crud/src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.1/8 is considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl) 104 | .then(response => { 105 | // Ensure service worker exists, and that we really are getting a JS file. 106 | const contentType = response.headers.get('content-type'); 107 | if ( 108 | response.status === 404 || 109 | (contentType != null && contentType.indexOf('javascript') === -1) 110 | ) { 111 | // No service worker found. Probably a different app. Reload the page. 112 | navigator.serviceWorker.ready.then(registration => { 113 | registration.unregister().then(() => { 114 | window.location.reload(); 115 | }); 116 | }); 117 | } else { 118 | // Service worker found. Proceed as normal. 119 | registerValidSW(swUrl, config); 120 | } 121 | }) 122 | .catch(() => { 123 | console.log( 124 | 'No internet connection found. App is running in offline mode.' 125 | ); 126 | }); 127 | } 128 | 129 | export function unregister() { 130 | if ('serviceWorker' in navigator) { 131 | navigator.serviceWorker.ready.then(registration => { 132 | registration.unregister(); 133 | }); 134 | } 135 | } 136 | --------------------------------------------------------------------------------