Refactor authentication with Context

This commit is contained in:
2020-08-21 11:51:52 +02:00
parent ec65c3b9dd
commit 51ec69a3cb
11 changed files with 137 additions and 109 deletions

View File

@@ -0,0 +1,7 @@
import { createContext, useContext } from 'react';
export const AuthContext = createContext();
export function useAuth() {
return useContext(AuthContext);
}

View File

@@ -0,0 +1,9 @@
import axios from 'axios';
import { API_URL } from '../constants';
export const backend = axios.create({
baseURL: API_URL,
headers: {
'Content-type': 'application/json',
},
});