Comment, remove consoles, cleanup

pull/10616/head
Jared Scheib 2018-01-26 18:53:48 -08:00
parent 7134153cb5
commit 8d494d4588
5 changed files with 11 additions and 16 deletions

View File

@ -52,7 +52,6 @@ export const meChangeOrganizationFailed = () => ({
// re-hydrated. if `getMeAsync` is only being used to refresh me after creating
// an organization, this is undesirable behavior
export const getMeAsync = ({shouldResetMe = false} = {}) => async dispatch => {
console.log('getMeAsync dispatch', dispatch)
if (shouldResetMe) {
dispatch(authRequested())
dispatch(meGetRequested())
@ -79,16 +78,15 @@ export const getMeAsync = ({shouldResetMe = false} = {}) => async dispatch => {
// Global links state also needs to be refreshed upon organization change so
// that Admin Chronograf / Current Org User tab's link is valid, but this is
// happening automatically because we are using a browser redirect to reload
// the application. if at some point we stop using a redirect and instead
// make it a seamless SPA experience, a la issue #2463, we'll need to refresh
// links manually.
// the application. If at some point we stop using a redirect and instead
// make it a seamless SPA experience, a la issue #2463, we'll need to make sure
// links are still refreshed.
export const meChangeOrganizationAsync = (
url,
organization
) => async dispatch => {
dispatch(meChangeOrganizationRequested())
try {
console.log('meChangeOrganizationAsync url', url)
const {data: me, auth, logoutLink} = await updateMeAJAX(url, organization)
const currentRole = me.roles.find(
r => r.organization === me.currentOrganization.id

View File

@ -18,11 +18,9 @@ const linksGetFailed = () => ({
})
export const getLinksAsync = () => async dispatch => {
console.log('getLinksAsync dispatch', dispatch)
dispatch(linksGetRequested())
try {
const {data} = await getLinksAJAX()
console.log('getLinksAJAX links', data)
dispatch(linksGetCompleted(data))
} catch (error) {
const message = `Failed to retrieve api links from ${linksLink}`

View File

@ -4,13 +4,12 @@ import {linksLink} from 'shared/constants'
export const getLinks = async () => {
try {
const res = await getAJAX(linksLink)
const response = await getAJAX(linksLink)
// TODO: Remove use of links entirely from within AJAX function so that
// call to setAJAXLinks is not necessary. See issue #1486.
setAJAXLinks({updatedLinks: response.data})
// TODO: remove use of links entirely from within AJAX function so that
// call to setAJAXLinks is not necessary. see issue #1486
setAJAXLinks({updatedLinks: res.data})
return res
return response
} catch (error) {
console.error(error)
throw error

View File

@ -14,7 +14,6 @@ import {SUPERADMIN_ROLE} from 'src/auth/Authorized'
class UserNavBlock extends Component {
handleChangeCurrentOrganization = organizationID => async () => {
const {router, links, meChangeOrganization} = this.props
console.log('handleChangeCurrentOrganization', links.me)
await meChangeOrganization(links.me, {organization: organizationID})
router.push('')
}

View File

@ -67,8 +67,9 @@ const AJAX = async (
headers,
})
// TODO: just return the unadulterated response, once auth, me, and
// logoutLink are refactored elsewhere
// TODO: Just return the unadulterated response without grafting auth, me,
// and logoutLink onto this object, once those are retrieved via their own
// AJAX request and action creator.
return links ? generateResponseWithLinks(response, links) : response
} catch (error) {
const {response} = error