File tree 2 files changed +4
-16
lines changed 2 files changed +4
-16
lines changed Original file line number Diff line number Diff line change 1
- import React , { useState , useEffect , useContext } from 'react' ;
1
+ import React , { useState , useEffect } from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
3
import { Link } from 'react-router-dom' ;
4
4
import axios from 'axios' ;
5
5
import PersonalMenu from '../PersonalMenu' ;
6
6
import { Grid , Breadcrumbs , Typography } from '@material-ui/core' ;
7
7
import NavigateNextIcon from '@material-ui/icons/NavigateNext' ;
8
- import { AuthContext } from '../Auth/AuthContext' ;
9
8
10
9
function ResourcePage ( { matchProps } ) {
11
10
const [ resource , setResource ] = useState ( { } ) ;
12
- const authContext = useContext ( AuthContext ) ;
13
11
14
12
useEffect ( ( ) => {
15
13
axios
16
- . get ( '/api/v1/resources/' + matchProps . match . params . guid , {
17
- headers : {
18
- Authorization : `Bearer ${ authContext . authTokens . token } ` ,
19
- } ,
20
- } )
14
+ . get ( '/api/v1/resources/' + matchProps . match . params . guid )
21
15
. then ( function ( response ) {
22
16
// handle success
23
17
setResource ( response . data ) ;
Original file line number Diff line number Diff line change 1
- import React , { useState , useEffect , useContext } from 'react' ;
1
+ import React , { useState , useEffect } from 'react' ;
2
2
import axios from 'axios' ;
3
3
import PersonalMenu from '../PersonalMenu' ;
4
4
import Search from '../Search' ;
5
5
import Grid from '@material-ui/core/Grid' ;
6
6
import { ResourceCard } from './ResourceCard' ;
7
- import { AuthContext } from '../Auth/AuthContext' ;
8
7
9
8
function Resources ( ) {
10
9
const [ resources , setResources ] = useState ( [ ] ) ;
11
- const authContext = useContext ( AuthContext ) ;
12
10
13
11
useEffect ( ( ) => {
14
12
axios
15
- . get ( '/api/v1/resources' , {
16
- headers : {
17
- Authorization : `Bearer ${ authContext . authTokens . token } ` ,
18
- } ,
19
- } )
13
+ . get ( '/api/v1/resources' )
20
14
. then ( function ( response ) {
21
15
// handle success
22
16
setResources ( response . data . results ) ;
You can’t perform that action at this time.
0 commit comments