import { fetchQueueByProfileId } from '../services' class Login { constructor() { this.currentProfileId = null this.survey = null this.queue = null this.matches = null } _setSurvey(survey) { this.survey = [] } async getQueue() { this.queue = null try { const queueList = await fetchQueueByProfileId(this.currentProfileId) const formatted = this._reformatProfiles(queueList) this._SET_QUEUE(formatted) } catch (err) { console.error(err) } } _reformatProfiles(profiles) { const formattedList = profiles.map(profile => { return { pid: profile.profile_id, name: profile.user_name, avatar: profile.user_media, } }) return formattedList } _SET_QUEUE(queue) { this.queue = queue } logout() { this.currentProfileId = null } async login(pid) { this.currentProfileId = parseInt(pid) } } export { Login }