Skip to content

Instantly share code, notes, and snippets.

@ksakae1216
Created January 29, 2022 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksakae1216/0d6e15ebb3e6436520d66ffba1a2fc91 to your computer and use it in GitHub Desktop.
Save ksakae1216/0d6e15ebb3e6436520d66ffba1a2fc91 to your computer and use it in GitHub Desktop.
import { createAction, props } from '@ngrx/store';
// ログインするときのactionです、ログインID、パスワードをactionの引数に持ちたい時の書き方
// '[Login] Do Login'は、'[どの画面]どんな処理'のようなイメージです
export const doLogin = createAction(
'[Login] Do Login',
props<{ loginId: string, password: string }>()
);
// storeのisLoginを更新したい時。更新したい値を引数にする
export const setLoginStateSuccess = createAction(
'[Login] Set Login State Success',
props<{ isLogin: boolean}>()
);
// こちらもstoreのerrorMessageを更新
export const setErrorMessage = createAction(
'[Login] Set ErrorMessage',
props<{ errorMessage: string }>()
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment