-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AWS Cognito authenticator for pages
Add advanced login bar
- Loading branch information
Showing
26 changed files
with
374 additions
and
220 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
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 |
---|---|---|
@@ -1,21 +1,11 @@ | ||
import * as types from './ActionTypes'; | ||
import Amplify from 'aws-amplify'; | ||
import { Auth } from "aws-amplify"; | ||
import config from 'config'; | ||
export * from './auth.js'; | ||
|
||
Amplify.configure(config.aws); | ||
|
||
export const updateConfig = () => ({ | ||
type: types.UPDATE_CONFIG | ||
}); | ||
|
||
export const priceFeed = (feedData) => ({ | ||
type: types.PRICE_FEED, | ||
feedData | ||
}); | ||
|
||
export const authStatus = (authStatus) => ({ | ||
type: types.AUTH_STATUS, | ||
authStatus | ||
}) | ||
}); |
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,49 @@ | ||
import * as types from './ActionTypes'; | ||
import { Storage } from 'aws-amplify'; | ||
|
||
export const settingSaveInProgress = () => { | ||
return { type: types.SETTING_SAVE_IN_PROGRESS } | ||
} | ||
|
||
export const settingSaveFailed = (error) => { | ||
return { type: types.SETTING_SAVE_FAILED, error } | ||
} | ||
|
||
export const settingSaveSuccess= () => { | ||
return { type: types.SETTING_SAVE_SUCCESS } | ||
} | ||
|
||
export const settingLoadInProgress= () => { | ||
return { type: types.SETTING_LOAD_IN_PROGRESS } | ||
} | ||
|
||
export const settingLoadFailed = (error) => { | ||
return { type: types.SETTING_LOAD_FAILED, error } | ||
} | ||
|
||
export const settingLoadSuccess = () => { | ||
return { type: types.SETTING_LOAD_SUCCESS } | ||
} | ||
|
||
export const updateConfig = () => ({ | ||
type: types.UPDATE_CONFIG | ||
}); | ||
|
||
export const loadConfig = async (dispatch, force) => { | ||
let existingConfig = localStorage.getItem('config'); | ||
if (!existingConfig || force) { | ||
try { | ||
let url = await Storage.get('config.json', { level: 'private', contentType: 'text/json'}) | ||
let config = await (await fetch(url)).json() | ||
localStorage.setItem('config', JSON.stringify(config)) | ||
} catch (error) { | ||
console.log("Failed to load config: " + error) | ||
const configTemplate = { | ||
users: [], | ||
exchanges: [], | ||
} | ||
localStorage.setItem('config', JSON.stringify(configTemplate)); | ||
} | ||
} | ||
dispatch(updateConfig()); | ||
} |
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.