-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1468 from Lumieducation/master
v0.7.2
- Loading branch information
Showing
17 changed files
with
422 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import superagent from 'superagent'; | ||
|
||
import { ISystemState } from './SystemTypes'; | ||
|
||
export async function getSystem(): Promise<ISystemState> { | ||
return (await superagent.get(`/api/v1/system`)).body; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as Sentry from '@sentry/browser'; | ||
|
||
import { | ||
SYSTEM_GET_SYSTEM_REQUEST, | ||
SYSTEM_GET_SYSTEM_ERROR, | ||
SYSTEM_GET_SYSTEM_SUCCESS | ||
} from './SystemTypes'; | ||
|
||
import * as API from './SystemAPI'; | ||
|
||
export function getSystem(): any { | ||
return async (dispatch: any) => { | ||
try { | ||
dispatch({ | ||
payload: {}, | ||
type: SYSTEM_GET_SYSTEM_REQUEST | ||
}); | ||
|
||
try { | ||
const system = await API.getSystem(); | ||
|
||
dispatch({ | ||
payload: system, | ||
type: SYSTEM_GET_SYSTEM_SUCCESS | ||
}); | ||
return system; | ||
} catch (error) { | ||
Sentry.captureException(error); | ||
|
||
dispatch({ | ||
payload: { error }, | ||
type: SYSTEM_GET_SYSTEM_ERROR | ||
}); | ||
} | ||
} catch (error) {} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as Sentry from '@sentry/browser'; | ||
|
||
import { | ||
ISystemActionTypes, | ||
ISystemState, | ||
SYSTEM_GET_SYSTEM_SUCCESS | ||
} from './SystemTypes'; | ||
|
||
export const initialState: ISystemState = { | ||
platformSupportsUpdates: true | ||
}; | ||
|
||
export default function settingsReducer( | ||
state: ISystemState = initialState, | ||
action: ISystemActionTypes | ||
): ISystemState { | ||
try { | ||
switch (action.type) { | ||
case SYSTEM_GET_SYSTEM_SUCCESS: | ||
return action.payload; | ||
|
||
default: | ||
return state; | ||
} | ||
} catch (error) { | ||
Sentry.captureException(error); | ||
return state; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
export interface IState { | ||
system: ISystemState; | ||
} | ||
|
||
export interface ISystemState { | ||
platformSupportsUpdates: boolean; | ||
} | ||
|
||
export const SYSTEM_GET_SYSTEM_REQUEST = 'SYSTEM_GET_SYSTEM_REQUEST'; | ||
export const SYSTEM_GET_SYSTEM_SUCCESS = 'SYSTEM_GET_SYSTEM_SUCCESS'; | ||
export const SYSTEM_GET_SYSTEM_ERROR = 'SYSTEM_GET_SYSTEM_ERROR'; | ||
|
||
export interface IGetSystemRequestAction { | ||
payload: {}; | ||
type: typeof SYSTEM_GET_SYSTEM_REQUEST; | ||
} | ||
|
||
export interface IGetSystemSuccessAction { | ||
payload: ISystemState; | ||
type: typeof SYSTEM_GET_SYSTEM_SUCCESS; | ||
} | ||
export interface IGetSystemErrorAction { | ||
payload: { | ||
error: string; | ||
}; | ||
type: typeof SYSTEM_GET_SYSTEM_ERROR; | ||
} | ||
|
||
export type ISystemActionTypes = | ||
| IGetSystemErrorAction | ||
| IGetSystemRequestAction | ||
| IGetSystemSuccessAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.