Verify user in admin

- If 404, user don't exist in admin, it will be anonym user
- if 403, user is ban or not associate in the world
This commit is contained in:
Gregoire Parant 2020-10-19 20:49:30 +02:00
parent bf9dfcc835
commit dfa6d2cc66
2 changed files with 24 additions and 2 deletions

View file

@ -61,6 +61,17 @@ class AdminApi {
)
return res.data;
}
async fetchCheckUserByToken(organizationMemberToken: string): Promise<AdminApiData> {
if (!ADMIN_API_URL) {
return Promise.reject('No admin backoffice set!');
}
//todo: this call can fail if the corresponding world is not activated or if the token is invalid. Handle that case.
const res = await Axios.get(ADMIN_API_URL+'/api/check-user/'+organizationMemberToken,
{ headers: {"Authorization" : `${ADMIN_API_TOKEN}`} }
)
return res.data;
}
reportPlayer(reportedUserUuid: string, reportedUserComment: string, reporterUserUuid: string) {
return Axios.post(`${ADMIN_API_URL}/api/report`, {