forked from CSGOWTF/csgowtf
refactored code
This commit is contained in:
19
src/utils/ApiRequests.js
Normal file
19
src/utils/ApiRequests.js
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user