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
// prefer this | |
const ExamplePage = () => { | |
return ( | |
<> | |
<div> | |
<h1>Card 1!</h1> | |
<h2>A simple card!</h2> | |
</div> | |
<div> |
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'; | |
interface IImage { | |
alt: string; | |
src: string; | |
} | |
interface IGalleryProps { | |
images: IImage[] | |
} |
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 { call, put, takeLatest } from 'redux-saga/effects' | |
import client from '../httpClient' | |
const createAction = (type) => (payload) => ({ | |
type, | |
payload, | |
}) | |
const http = { | |
login: (credentials) => client.post('/login', credentials), |
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
const foo = 'hello' |
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 { call, put, takeLatest } from 'redux-saga/effects' | |
import { createStandardAction, ActionType, getType } from 'typesafe-actions' | |
import client from '../httpClient' | |
interface ILogin { | |
email: string; | |
password: string; | |
} | |
interface IUser { |
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 { connect } from "react-redux"; | |
import Dashboard from "./dashboard"; | |
import { ApplicationState } from "../../store"; | |
const mapStateToProps = (state: ApplicationState) => { | |
const sessions = sessionsArraySelector(state) | |
console.log(sessions) | |
return { | |
user: state.oidc.user, | |
sessions: Object.values(sessions), |
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 axios from 'axios' | |
export const http = axios.create({ | |
baseUrl: 'https://localhost:3000', | |
headers: { | |
//... | |
}, | |
}) | |
http.interceptors.response.use(response => response.data, err => throw new Error(err)) |
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 store from './store' | |
export default class HttpClient { | |
getUser() { | |
const token = store.getState() | |
// fetch and pass along your token | |
} | |
} |
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 httpClient from './httpClient' | |
const login = (email, password) => (dispatch) => { | |
return httpClient.login(email, password) | |
.then(response => { | |
httpClient.token = response.token | |
dispatch(loginSuccess(response)) | |
}) | |
} |
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 axios from "axios"; | |
import moment from "moment"; | |
export default class Feutred extends Component { | |
state = { | |
sports: [], | |
events: [], | |
isLoading: true, | |
errors: null |
NewerOlder