"Fossies" - the Fresh Open Source Software Archive 
Member "jitsi-meet-7550/react/features/google-api/reducer.ts" (26 Sep 2023, 1145 Bytes) of package /linux/misc/jitsi-meet-7550.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 import ReducerRegistry from '../base/redux/ReducerRegistry';
2
3 import {
4 SET_GOOGLE_API_PROFILE,
5 SET_GOOGLE_API_STATE
6 } from './actionTypes';
7 import { GOOGLE_API_STATES } from './constants';
8
9 /**
10 * The default state is the Google API needs loading.
11 *
12 * @type {{googleAPIState: number}}
13 */
14 const DEFAULT_STATE = {
15 googleAPIState: GOOGLE_API_STATES.NEEDS_LOADING,
16 profileEmail: ''
17 };
18
19 export interface IGoogleApiState {
20 googleAPIState: number;
21 googleResponse?: Object;
22 profileEmail: string;
23 }
24
25 /**
26 * Reduces the Redux actions of the feature features/google-api.
27 */
28 ReducerRegistry.register<IGoogleApiState>('features/google-api',
29 (state = DEFAULT_STATE, action): IGoogleApiState => {
30 switch (action.type) {
31 case SET_GOOGLE_API_STATE:
32 return {
33 ...state,
34 googleAPIState: action.googleAPIState,
35 googleResponse: action.googleResponse
36 };
37 case SET_GOOGLE_API_PROFILE:
38 return {
39 ...state,
40 profileEmail: action.profileEmail
41 };
42 }
43
44 return state;
45 });