diff --git a/src/cpuRepository.ts b/src/cpuRepository.ts index dd55519..2d4eb7f 100644 --- a/src/cpuRepository.ts +++ b/src/cpuRepository.ts @@ -8,8 +8,7 @@ export class CpuRepository { const fetchResult = await fetch("../data.json"); this.#cpuList = await fetchResult.json(); - this.#currentCPU = this.getRandomCpu(); - this.#nextCPU = this.getRandomCpu(); + this.reset(); } get currentCpu() { @@ -39,4 +38,9 @@ export class CpuRepository { this.#currentCPU = this.#nextCPU this.#nextCPU = this.getRandomCpu(); } + + reset(): void { + this.#currentCPU = this.getRandomCpu(); + this.#nextCPU = this.getRandomCpu(); + } } \ No newline at end of file