changed axios to axiosInstance

This commit is contained in:
Maciek Głowacki 2020-11-21 12:57:30 +01:00
parent 2236244266
commit 9b146a4b3a

View File

@ -1,6 +1,6 @@
import React, { useState, useEffect, createContext, ReactNode } from 'react'; import React, { useState, useEffect, createContext, ReactNode } from 'react';
import { User } from '../types'; import { User } from '../types';
import axios from 'axios'; import { axiosInstance } from '../utils/axiosInstance';
export interface CASContext { export interface CASContext {
user?: User; user?: User;
@ -29,7 +29,7 @@ export const CASProvider = ({ children }: CASProviderProps) => {
} }
try { try {
if (!sessionStorage.getItem('userToken')) { if (!sessionStorage.getItem('userToken')) {
const { data: token } = await axios.get(`${process.env.REACT_APP_API_URL}/token?ticket=${ticket}`); const { data: token } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/token?ticket=${ticket}`);
sessionStorage.setItem('userToken', token); sessionStorage.setItem('userToken', token);
} }
const token = sessionStorage.getItem('userToken'); const token = sessionStorage.getItem('userToken');