Skip to content

Conversation

@nickovchinnikov
Copy link
Owner

No description provided.

yield call(logout);
}

export function* saveUserSession(action: PayloadAction<string>) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vvscode @saitonakamura
Плиз, подскажите, как сделать так, чтобы не типизировать action: PayloadAction<string>?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickovchinnikov никак ))тебе же нужно задать тип переменной

ты это можешь сделать или через тип переменной, который ты отдельно объявишь, или так

ну можешь ReturnType<typeof actions.saveUser>


export function* loginSaga() {
yield fork(checkUserSession);
yield takeEvery(actions.login.type, saveUserSession);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

К вопросу выше, не может это как то сменеджиться тут?
yield takeEvery(actions.login.type, saveUserSession);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не понял вопрос )

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://redux-saga.js.org/docs/api/#takeeverypattern-saga-args

takeEvery вызывает saveUserSession с подпиской на событие
Вот и подумал, вдруг есть возможность сделать вызов с матчингом сигнатуры вот тут
#39 (comment)

Fix action type in saga
StandartGame refactoring
Field fix
@nickovchinnikov nickovchinnikov merged commit 84cfc5b into master Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants