-
Notifications
You must be signed in to change notification settings - Fork 1
/
logout.ts
35 lines (29 loc) · 886 Bytes
/
logout.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { createApiActions } from '@ackee/redux-utils';
import { actionType } from 'services/utils';
export type LogoutRequestPayload = void;
export type LogoutSuccessPayload = void;
export type LogoutFailurePayload = Error;
const ACTION_TYPE_PREFIX = actionType('LOGOUT');
/**
* @ignore
*/
export const logout = createApiActions<
typeof ACTION_TYPE_PREFIX,
LogoutRequestPayload,
LogoutSuccessPayload,
LogoutFailurePayload
>(ACTION_TYPE_PREFIX);
/**
* Triggers a user logout flow: tokens are cleared from a persistent storage and any auth. data are cleared from the reducer.
* @category Redux Action Creator
* @example
* ```ts
* import { put } from 'redux-saga/effects';
* import { logoutRequest } from '@ackee/petrus';
*
* function* logoutSaga() {
* yield put(logoutRequest());
* }
* ```
*/
export const logoutRequest = logout.request;