Leon %!s(int64=2) %!d(string=hai) anos
pai
achega
23a871b3a9
Modificáronse 1 ficheiros con 8 adicións e 3 borrados
  1. 8 3
      src/features/trackTimeDuration/components/Console.tsx

+ 8 - 3
src/features/trackTimeDuration/components/Console.tsx

@@ -14,6 +14,7 @@ import { EndFastBtn, EndSleepBtn, StartFastBtn, StartSleepBtn } from "@/features
 import Box from "@/components/layout/Box";
 import './Console.scss'
 import { ConsoleType, changeConsoleStatus } from "@/store/console";
+import { updateScenario } from "@/store/time";
 
 export default function Component(props: { isNextStep?: boolean }) {
     const scenario = useSelector((state: any) => state.scenario);
@@ -202,6 +203,7 @@ export default function Component(props: { isNextStep?: boolean }) {
         if (isFast) {
             if (time.status == 'WAIT_FOR_START') {
                 startFast(t, fastDuration).then(res => {
+                    dispatch(updateScenario((res as any).current_record));
                     if ((res as any).current_record.scenario == 'FAST_SLEEP' &&
                         (res as any).current_record.status == 'ONGOING1') {
                         global.consoleType = 'going'
@@ -212,19 +214,22 @@ export default function Component(props: { isNextStep?: boolean }) {
                 });
             }
             else {
-                endFast(t).then(_ => {
+                endFast(t).then(res => {
+                    dispatch(updateScenario((res as any).current_record));
                     global.postBtnUpdateStatus('idle');
                 })
             }
         }
         else {
             if (time.status == 'WAIT_FOR_START' || time.status == 'ONGOING1') {
-                startSleep(t, sleepDuration).then(_ => {
+                startSleep(t, sleepDuration).then(res => {
+                    dispatch(updateScenario((res as any).current_record));
                     global.postBtnUpdateStatus('idle');
                 });
             }
             else {
-                endSleep(t).then(_ => {
+                endSleep(t).then(res => {
+                    dispatch(updateScenario((res as any).current_record));
                     global.postBtnUpdateStatus('idle');
                 })
             }