Skip to content

Commit

Permalink
fix: Return sleepdata
Browse files Browse the repository at this point in the history
  • Loading branch information
CaedenPH committed Aug 29, 2024
1 parent 8a0fbd6 commit 53adaf1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CogSpeedGame } from "./routes/game";
import { StartPage } from "./routes/start";
import { Config } from "./types/Config";
import { CogSpeedGraphicsHandler } from "./ui/handler";
import { SleepData } from "./types/SleepData";


function createApp(): Application {
Expand Down Expand Up @@ -49,7 +50,7 @@ async function loadConfig(): Promise<Config> {
* @param config
* @param startNow Called from restart. Bypasses sleep data
*/
export async function startUp(config: Config | null = null, startNowData: Record<string, any> | false = false) {
export async function startUp(config: Config | null = null, startNowData: SleepData | false = false) {
if (config === null) {
config = await loadConfig();
if (config.error) throw new Error(config.reason);
Expand Down
4 changes: 2 additions & 2 deletions src/routes/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@ private async confirmSleepData(sleepData: { [key: string]: any }): Promise<boole
* TODO: Seperate pages better
* @returns {Promise<SleepData>} The test data
*/
public async start(sleepData: Record<string, any> | false): Promise<SleepData | false> {
public async start(sleepData: SleepData | false): Promise<SleepData | false> {
if (process.env.NODE_ENV === "development") return {fatigueLevel: -1};

if (sleepData != false) {
await this.displayReadyDemo(Infinity);
return {fatigueLevel: 1};
return sleepData;
}

// Display the test disclaimer
Expand Down

0 comments on commit 53adaf1

Please sign in to comment.