saga-axios
v1.1.4
Published
This package is designed to simplify sending requests to the server and chaning request to request
Downloads
19
Readme
��#� �s�a�g�a�-�a�x�i�o�s�
�
������� ���� ������ ����� ����� ����� ������ ������ ������ ������ ������ ������� ����� ����� ������� ���������,� ���� ������ ������ �
�
������.�
�
�t�h�i�s� �p�a�c�k�a�g�e� �m�e�n�t� �t�o� �s�i�m�p�l�i�f�y� �t�h�e� �c�r�e�a�t�i�n�g� �o�f� �c�o�m�p�l�e�x� �w�e�b� �a�p�p�l�i�c�a�t�i�o�n�s�.� �
�
�t�h�i�s� �p�a�c�k�a�g�e� �p�r�o�v�i�d�e� �s�i�m�p�l�e� �i�n�t�e�r�f�a�c�e� �t�o� �c�h�a�i�n� �r�e�q�u�e�s�t� �w�i�t�h� �f�u�n�c�t�i�o�n�'�s� �o�r� �r�e�q�u�e�s�t�'�s�
�
�
�
������� ������
�
�#�#� �Q�u�i�c�k� �u�s�e�
�
�<�!�-�-� �1�.� ����� ����� ��t�a�k�e�E�v�e�r�y�S�e�n�d�T�o�P�r�o�c�e�s�s�
� ����� ������ �����'� �-�-�>�
�
�1�.� �i�m�p�o�r�t� ��t�a�k�e�E�v�e�r�y�S�e�n�d�T�o�P�r�o�c�e�s�s�
� �f�r�o�m� ��s�a�g�a�-�a�x�i�o�s�
� �i�n�t�o� ��s�a�g�a�M�i�d�d�l�e�w�a�r�e�.�r�u�n�(�)�
�:� �
�
��
��
�
�f�u�n�c�t�i�o�n�*� �r�o�o�t�S�a�g�a�(�)� �{�
�
� � �y�i�e�l�d� �a�l�l�(�[�f�o�r�k�(�t�a�k�e�E�v�e�r�y�S�e�n�d�T�o�P�r�o�c�e�s�s�)�]�)�;�
�
�}�
�
�s�a�g�a�M�i�d�d�l�e�w�a�r�e�.�r�u�n�(�r�o�o�t�S�a�g�a�)�
�
�
��
�
�
�
�
�2�.� ����� ����� ��s�e�n�d�T�o�P�r�o�c�e�s�s�
� ��c�o�r�e�
�
�2�.� �i�m�p�o�r�t� ��s�e�n�d�T�o�P�r�o�c�e�s�s�
� �f�r�o�m� ��s�a�g�a�-�a�x�i�o�s�
�
�
�3�.� �u�s�e� �i�n�s�i�d�e� ��d�i�s�p�a�t�c�h�
�
�
� � � � ��
��
�
� � � � �i�m�p�o�r�t� �{� �s�e�n�d�T�o�P�r�o�c�e�s�s�A�c�t�i�o�n� �}� �f�r�o�m� �'�s�a�g�a�-�a�x�i�o�s�/�c�o�r�e�'�;�
�
�
�
� � � � �c�o�n�s�t� �A�p�p� �=� �(�)� �=�>� �{�
�
� � � � � � � � �c�o�n�s�t� �d�i�s�p�a�t�c�h� �=� �u�s�e�D�i�s�p�a�t�c�h�(�)�
�
� � � � � � � � �c�o�n�s�t� �s�e�n�d�R�e�q� �=� �(�)� �=�>� �{�
�
� � � � � � � � �d�i�s�p�a�t�c�h�(�
�
� � � � � � � � � � � � �s�e�n�d�T�o�P�r�o�c�e�s�s�A�c�t�i�o�n�(�{�
�
� � � � � � � � � � � � �a�c�t�i�o�n�s�B�e�f�o�r�e�:� �[�]�,�
�
� � � � � � � � � � � � �u�r�l�:� �u�r�l�,�
�
� � � � � � � � � � � � �m�e�t�h�o�d�:� �/�/� �[�"�p�o�s�t�"� �,� �"�g�e�t�"� �,� �"�p�u�t�"� �,� �"�p�a�t�c�h�"� �,� �"�d�e�l�e�t�e�]�,�
�
� � � � � � � � � � � � �p�a�y�l�o�a�d� �:� �/�/� �a�n�y� �o�b�j�e�c�t� �t�o� �s�e�n�d� �o�v�e�r� �h�t�t�p�,�
�
� � � � � � � � � � � � �o�p�t�i�o�n�s�:� �{�
�
� � � � � � � � � � � � � � � � �w�i�t�h�T�o�k�e�n� �=� �t�r�u�e�,�
�
� � � � � � � � � � � � � � � � �c�o�n�t�e�n�t�T�y�p�e� �=� �"�a�p�p�l�i�c�a�t�i�o�n�/�j�s�o�n�"�,�
�
� � � � � � � � � � � � � � � � �c�o�n�f�i�g� �=� �{�
�
� � � � � � � � � � � � � � � � � � � � �\�\�d�e�s�t�r�u�c�t�o�r� �t�o� �a�x�i�o�s� �c�o�n�f�i�g� �(�e�.�g�.� �a�x�i�o�s�.�g�e�t�(�u�r�l� �,� �c�o�n�f�i�g�)� �|� �a�x�i�o�s�.�p�o�s�t�(�u�r�l� �,� �d�a�t�a�,� �c�o�n�f�i�g�)�)�
�
� � � � � � � � � � � � � � � � �}�,�
�
� � � � � � � � � � � � �}�,�
�
� � � � � � � � � � � � �a�c�t�i�o�n�s�:� �[�]�,�
�
� � � � � � � � � � � � �}�)�)�;�
�
� � � � � � � � �}�
�
� � � � � � � � �r�e�t�u�r�n� �<�b�u�t�t�o�n� �o�n�C�l�i�c�k�=�{�s�e�n�d�R�e�q�}�>�S�E�N�D�<�/�b�u�t�t�o�n�>�
�
� � � � � � � � �
�
� � � � �}�
�
� � � � �
��
�
�
�
�
�4�.� ������ ���������
�
����� ������ ������� ��� ��w�r�a�p�A�c�t�i�o�n�
� � �
�
�
�
��
��
�
� � � � �d�i�s�p�a�t�c�h�(�
�
� � � � � � � � �s�e�n�d�T�o�P�r�o�c�e�s�s�A�c�t�i�o�n�(�{�
�
� � � � � � � � � � �a�c�t�i�o�n�s�B�e�f�o�r�e�:� �[�
�
� � � � � � � � � � � � �w�r�a�p�A�c�t�i�o�n�(�{�
�
� � � � � � � � � � � � � � �o�n�:� �"�A�N�Y�"�,�
�
� � � � � � � � � � � � � � �f�u�n�c�:� �(�)� �=�>� �{�
�
� � � � � � � � � � � � � � � � �d�o�_�s�o�m�e�t�h�i�n�g�(�)�
�
� � � � � � � � � � � � � � �}�,�
�
� � � � � � � � � � � � �}�)�,�
�
� � � � � � � � � � �]�,�
�
� � � � � � � � � � �u�r�l�:� �u�r�l�,�
�
� � � � � � � � � � �m�e�t�h�o�d�,�
�
� � � � � � � � � � �p�a�y�l�o�a�d�,�
�
� � � � � � � � � � �o�p�t�i�o�n�s�:� �{�}�,�
�
� � � � � � � � � � �a�c�t�i�o�n�s�:� �[�
�
� � � � � � � � � � � � �w�r�a�p�A�c�t�i�o�n�(�{�
�
� � � � � � � � � � � � � � � � �\�\�r�u�n� �w�h�e�n� �t�h�e� �r�e�q�u�e�s�t� �s�e�n�d� �s�u�c�c�e�s�s�f�u�l�y� � � � �
�
� � � � � � � � � � � � � � �o�n�:� �"�S�U�C�C�E�S�S�"�,�
�
� � � � � � � � � � � � � � �f�u�n�c�:� �(�)� �=�>� �{�
�
� � � � � � � � � � � � � � � � � � � � �d�o�_�s�o�m�e�t�h�i�n�g�(�)�
�
� � � � � � � � � � � � � � �}�,�
�
� � � � � � � � � � � � �}�)�,�
�
� � � � � � � � � � � � �w�r�a�p�A�c�t�i�o�n�(�{�
�
� � � � � � � � � � � � � � � � �\�\�r�u�n� �w�h�e�n� �t�h�e� �r�e�q�u�e�s�t� �s�e�n�d� �f�a�i�l�
�
� � � � � � � � � � � � � � �o�n�:� �"�F�A�I�L�"�,�
�
� � � � � � � � � � � � � � �p�a�y�l�o�a�d�:� �"�d�a�t�a�.�u�s�e�r�.�n�a�m�e�"�
�
� � � � � � � � � � � � � � �f�u�n�c�:� �(�n�a�m�e�)� �=�>� �{�
�
� � � � � � � � � � � � � � � � �d�o�_�s�o�m�e�t�h�i�n�g�_�w�i�t�h�_�u�s�e�r�_�n�a�m�e�(�n�a�m�e�)�
�
� � � � � � � � � � � � � � �}�,�
�
� � � � � � � � � � � � �}�)�,�
�
� � � � � � � � � � � � �{� �/�/� �c�a�l�l� �t�o� �a�n�o�t�h�e�r� �a�p�i� �c�a�l�l� �w�i�t�h� �a�c�t�i�o�n�,� �b�e�f�o�r�e�A�c�t�i�o�n�.�.�.�
�
� � � � � � � � � � � � �\�\�r�u�n� �w�h�e�n� �t�h�e� �r�e�q�u�e�s�t� �s�e�n�d� �s�u�c�c�e�s�s�f�u�l�y�
�
� � � � � � � � � � � � � � �o�n�:� �"�S�U�C�C�E�S�S�"�,�
�
� � � � � � � � � � � � � � �p�a�y�l�o�a�d�:� �"�d�a�t�a�"�,�
�
� � � � � � � � � � � � � � �f�u�n�c�:� �(�d�a�t�a�)� �=�>� �{�
�
� � � � � � � � � � � � � � � � �d�i�s�p�a�t�c�h�(�s�e�n�d�T�o�P�r�o�c�e�s�s�A�c�t�i�o�n�(�{�
�
� � � � � � � � � � � � � � � � � � � � �s�a�m�e�_�a�t�t�r�_�e�t�c�.�.�
�
� � � � � � � � � � � � � � � � �}�)�)�;�
�
� � � � � � � � � � � � � � �}�,�
�
� � � � � � � � � � � � �}�,�
�
� � � � � � � � � � �]�,�
�
� � � � � � � � �}�)�
�
� � � � � � �)�;�
�
�
��
�