j-toscani / doppelkopf

German card game in the Browser
0 stars 0 forks source link

Encapsulate actions/server calls #45

Closed j-toscani closed 5 months ago

j-toscani commented 6 months ago

Is your feature request related to a problem? Please describe. Actions use mostly the same code. Sooner or later we will need to implement some way for authentication information to be passed on certain actions. As a Result, I want a unified way to handle Request.

Describe the solution you'd like Use a hook which returns an object with all possible actions. Each action has the same Interface:

type Action<I,R> = (input: I) => Promise<R> 

Describe alternatives you've considered

Additional context Errors are handled by the caller. Related to #43