add authorization

This commit is contained in:
Henry
2023-05-13 23:10:59 +01:00
parent 8270707668
commit 05bd7bc793
9 changed files with 317 additions and 9 deletions
+14
View File
@@ -8,4 +8,18 @@ const apiClient = axios.create({
}
})
apiClient.interceptors.request.use(function (config) {
const username = localStorage.getItem('username')
const password = localStorage.getItem('password')
if (username && password) {
config.auth = {
username: username.toLocaleLowerCase(),
password: password.toLocaleLowerCase()
}
}
return config
})
export default apiClient