From a4e19a0c6f773e5b12d7f8731520f6b8985ca3c7 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Sat, 3 Jul 2021 11:34:07 +0200 Subject: [PATCH] Fix states Signed-off-by: Arthur DANJOU --- app/Controllers/Http/StatesController.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/app/Controllers/Http/StatesController.ts b/app/Controllers/Http/StatesController.ts index b8b8bb4..ed29498 100755 --- a/app/Controllers/Http/StatesController.ts +++ b/app/Controllers/Http/StatesController.ts @@ -2,27 +2,16 @@ import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext"; import Redis from "@ioc:Adonis/Addons/Redis"; import {UpdateGitHubReadme} from "App/Tasks/UpdateGithubReadme"; -interface STATE { - state: string -} - -const STATES: Array = [ - {state: 'developing'}, - {state: 'learning'}, - {state: 'listening_music'}, - {state: 'learning'} -] - export default class StatesController { public async get({response}: HttpContextContract) { - const states = STATES.map(async state => { - return this.getStatus(await Redis.get(`states:is_${state.state}`)) - }) return response.status(200).send({ states: { - states + "is_sleeping": this.getStatus(await Redis.get(`states:is_sleeping`)), + "is_developing": this.getStatus(await Redis.get(`states:is_developing`)), + "is_learning": this.getStatus(await Redis.get(`states:is_learning`)), + "is_listening_music": this.getStatus(await Redis.get(`states:is_listening_music`)), } }) }