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
| export const users = [{ | |
| id: 1, | |
| first_name: "Giffy", | |
| last_name: "Crookall", | |
| email: "gcrookall0@dmoz.org", | |
| gender: "Male" | |
| }, { | |
| id: 2, | |
| first_name: "Dolli", | |
| last_name: "Pochet", |
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
| import { users, departaments } from '../mock' | |
| export const getUsers = async () => { | |
| return new Promise(resolve => setTimeout(() => { | |
| resolve(users) | |
| }, 2000)) | |
| } | |
| export const getDepartments = async () => { | |
| return new Promise(resolve => setTimeout(() => { |
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
| import React, { Component } from 'react' | |
| import { getUsers } from '../services/api' | |
| class Users extends Component { | |
| getUsers = async () => { | |
| const response = await getUsers() | |
| console.log({ response }) | |
| } |
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
| import React, { Component } from 'react' | |
| import { getDepartments } from '../services/api' | |
| class Departments extends Component { | |
| getDepartments = async () => { | |
| const response = await getDepartments() | |
| console.log({ response }) | |
| } |
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
| import React, { Component, Fragment } from 'react' | |
| import Departments from './components/Departments' | |
| import Users from './components/Users' | |
| import './index.css' | |
| class App extends Component { | |
| render() { | |
| return ( |
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
| .overlay-content { | |
| display: flex; | |
| width: 100%; | |
| left: 0; | |
| top: 0; | |
| align-items: center; | |
| height: 100%; | |
| justify-content: center; | |
| position: fixed; | |
| z-index: 999999; |
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
| import React from 'react' | |
| import Spinner from 'react-spinkit' | |
| const Loading = ({ loading, message }) => { | |
| return loading ? ( | |
| <div className='overlay-content'> | |
| <div className='wrapper'> | |
| <Spinner | |
| name='pacman' |
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
| import React, { Component, Fragment } from 'react' | |
| import Loading from './Loading' | |
| import { getUsers } from '../services/api' | |
| class Users extends Component { | |
| state = { | |
| loading: false |
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
| import React, { Component, Fragment } from 'react' | |
| import Loading from './Loading' | |
| import { getDepartments } from '../services/api' | |
| class Departments extends Component { | |
| state = { | |
| loading: false |
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
| import React, { Component, Fragment } from 'react' | |
| import Departments from './components/Departments' | |
| import Users from './components/Users' | |
| import './index.css' | |
| const LoadingContext = React.createContext({ | |
| loading: false, | |
| message: null, |