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, { Component } from 'react'; | |
import Message from './message'; | |
import { getMessage } from './getMessage'; | |
class Chat extends Component { | |
// Initial State. | |
state = { | |
messages: [getMessage()], | |
isStreaming: this.props.isStreaming | |
} |
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, { Component } from 'react'; | |
import Message from './message'; | |
import { getMessage } from './getMessage'; | |
class Chat extends Component { | |
// Initial State. | |
state = { | |
messages: [getMessage()], | |
isStreaming: this.props.isStreaming | |
} |
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, { Component } from 'react'; | |
import Message from './message'; | |
import { getMessage } from './getMessage'; | |
class Chat extends Component { | |
// Initial State. | |
state = { | |
messages: [getMessage()], | |
isStreaming: this.props.isStreaming | |
} |
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, { Component } from 'react'; | |
import Message from './message'; | |
import { getMessage } from './getMessage'; | |
class Chat extends Component { | |
// Initial State. | |
state = { | |
messages: [getMessage()], | |
isStreaming: this.props.isStreaming | |
} |
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, { useState, useEffect } from 'react'; | |
const Counter = () => { | |
// initial state. | |
const initialState = { | |
counter: 0 | |
}; | |
const [state, setState] = useState(initialState); |
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
// action types. | |
export const actions = { | |
SET_USER_INFO: "SET_USER_INFO", | |
SET_ALL_USERS: "SET_ALL_USERS", | |
SET_CURRENT_USER: "SET_CURRENT_USER", | |
}; | |
// set's the user to redux. | |
export const setUser = (data) => ({ | |
type: actions.SET_USER_INFO, |
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 { openNotificationWithIcon } from 'utils/notification'; | |
import api from 'utils/api'; | |
import { setAllCompanies } from '../actions/company.action'; | |
export const getAllCompanies = (resolve, reject) => { | |
return (dispatch) => { | |
getRequest(`${api.url}company`) | |
.then(({ data }) => { | |
dispatch(setAllCompanies(data)); | |
resolve(); |
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 { actions } from 'actions/company.action'; | |
// Initial State | |
const INITIAL_STATE = { | |
allCompanies: null, | |
currentCompany: null | |
}; | |
// Company Reducer. | |
export default (state = INITIAL_STATE, { type, data }) => { |
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 { combineReducers } from 'redux'; | |
import { routerReducer } from 'react-router-redux'; | |
import users from './user.reducer'; | |
import modal from './modal.reducer'; | |
import company from './company.reducer'; | |
// Root Reducer. | |
export default combineReducers({ | |
routing: routerReducer, | |
users, |
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 Dashboard from './Dashboard/Dashboard.index'; | |
import Users from './Users/Users.index'; | |
import Company from './Company/Company.index'; | |
import Profile from './Profile/Profile.index'; | |
// router configuration. | |
let routes = [ | |
{ | |
path: '/dashboard', | |
name: 'Project Dashboard', |
OlderNewer