Skip to content

Commit 85ce99f

Browse files
committed
fix(lib): handled per process for activation as return
1 parent 4001dde commit 85ce99f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/libs/activate-bfb.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ async function activateBfb(readlineInterface: readline.Interface): Promise<void>
1414
console.log('Token kosong, aktifasi gagal\n');
1515
await applyDelay(1000);
1616
readlineInterface.resume();
17+
return;
1718
}
1819

1920
const res = await fetch('https://bfb.blackfriday.my.id/api/v1/check', {
@@ -30,15 +31,18 @@ async function activateBfb(readlineInterface: readline.Interface): Promise<void>
3031
console.log('Response error, aktifasi gagal\n');
3132
await applyDelay(1000);
3233
readlineInterface.resume();
34+
return;
3335
}
3436

3537
const json = await res.json();
38+
3639
if (json?.state !== true) {
3740
readlineInterface.pause();
3841
console.clear();
3942
console.log('Token tidak valid, aktifasi gagal\n');
4043
await applyDelay(1000);
4144
readlineInterface.resume();
45+
return;
4246
}
4347

4448
const iv = crypto.randomBytes(16);
@@ -65,12 +69,14 @@ async function activateBfb(readlineInterface: readline.Interface): Promise<void>
6569
console.log('Token valid, aktifasi berhasil\n');
6670
await applyDelay(1000);
6771
readlineInterface.resume();
72+
return;
6873
} catch {
6974
readlineInterface.pause();
7075
console.clear();
7176
console.log('Server error, aktifasi gagal\n');
7277
await applyDelay(1000);
7378
readlineInterface.resume();
79+
return;
7480
}
7581
}
7682

0 commit comments

Comments
 (0)