本文整理匯總了TypeScript中src/store/authentication.setToken函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setToken函數的具體用法?TypeScript setToken怎麽用?TypeScript setToken使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setToken函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: setStorage
export const expire = () => {
// Remove these from local storage so if login fails, next time we jump to login sooner.
setStorage(AUTH_TOKEN, '');
setStorage(AUTH_SCOPES, '');
setStorage(AUTH_EXPIRE_DATETIME, '');
store.dispatch(setToken(null, null));
}
示例2: it
it('dispatches setToken from values in localStorage', () => {
window.localStorage.setItem(AUTH_TOKEN, testToken2);
window.localStorage.setItem(AUTH_SCOPES, testScopes);
refresh();
const action = setToken(testToken2, testScopes);
expect(store.dispatch).toHaveBeenCalledWith(action);
});
示例3: getStorage
export const refresh = () => {
const authToken = getStorage(AUTH_TOKEN);
const scopes = getStorage(AUTH_SCOPES);
store.dispatch(setToken(authToken, scopes));
}