rewrote the authorisation flow: give more responsability to gameManager and less to gameScene
This commit is contained in:
parent
032facb75f
commit
02c193a262
14 changed files with 244 additions and 170 deletions
|
@ -1,5 +1,6 @@
|
|||
import {ADMIN_API_TOKEN, ADMIN_API_URL} from "../Enum/EnvironmentVariable";
|
||||
import Axios, {AxiosError} from "axios";
|
||||
import Axios from "axios";
|
||||
import {RoomIdentifier} from "../Model/RoomIdentifier";
|
||||
|
||||
export interface AdminApiData {
|
||||
organizationSlug: string
|
||||
|
@ -22,13 +23,14 @@ class AdminApi {
|
|||
return res.data;
|
||||
}
|
||||
|
||||
async memberIsGrantedAccessToRoom(memberId: string, roomId: string): Promise<boolean> {
|
||||
async memberIsGrantedAccessToRoom(memberId: string, roomIdentifier: RoomIdentifier): Promise<boolean> {
|
||||
if (!ADMIN_API_URL) {
|
||||
return Promise.reject('No admin backoffice set!');
|
||||
}
|
||||
try {
|
||||
//todo: send more specialized data instead of the whole id
|
||||
const res = await Axios.get(ADMIN_API_URL+'/api/member/is-granted-access',
|
||||
{ headers: {"Authorization" : `${ADMIN_API_TOKEN}`}, params: {memberId, roomIdentifier: roomId} }
|
||||
{ headers: {"Authorization" : `${ADMIN_API_TOKEN}`}, params: {memberId, roomIdentifier: roomIdentifier.id} }
|
||||
)
|
||||
return !!res.data;
|
||||
} catch (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue