refactored code

This commit is contained in:
cnachtigall1991
2021-10-13 15:44:05 +02:00
parent 544ef95722
commit 5f3d0b981f
14 changed files with 250 additions and 156 deletions

19
src/utils/ApiRequests.js Normal file
View File

@@ -0,0 +1,19 @@
import axios from "axios";
export const GetUser = async (id) => {
try {
const res = await axios.get(`${process.env.VUE_APP_API_URL}/player/${id}`)
if (res.status === 200) {
return [200, res.data]
}
} catch (err) {
if (err.response) {
if (err.response.status === 404) {
return [404, 'Player not found']
}
} else {
console.log(err.response)
}
}
}