Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
I want to use saga effects in method of class

My class looks like this:

abstract class Processor {
  canBeRun(action: RootActions, curOrderModal: OrderModalStep, curOrderPage: OrderPageStep): boolean {
    throw new Error('The method must override, canBeRun()');
  }

  *_process(): Generator<any, any, any> {
    throw new Error('The method must override, _process()');
  }
}

class OrignalMembersOrder extends Processor {
  constructor() {
    super();
  }

  *_process(): Generator<any, any, any> {
    try {
      yield put(setCurOrderPage(OrderPageStep.original));//
    } catch (error) {
      console.log('error');
    }
  }
}


export function* test(): Generator<any, any, any> {
  const Array: Processor[] = [];

 Array.push(new OrignalMembersOrder());
 //Array.push(new OtherOrder...()); 
 //Array.push(new OtherOrder...());
 //Array.push(new OtherOrder...());
}

Array.map((processors) => {
    processors._process().next();
  });

and call the _process().next() method, I don't get the expected result ...

This part doesn't work

*_process(): Generator<any, any, any> {
    try {
      yield console.log("check") // success
      yield put(setCurOrderPage(OrderPageStep.original)); // failure
    } catch (error) {
      console.log('error');
    }
  }

yield console.log <- success

yield put(setCurOrderPage(OrderPageStep.original)) <- failure

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!