import {
  AUTHENTICATE,
  AUTHENTICATE_FAILED,
  AUTHENTICATE_SUCCEEDED,
  FETCH,
  INITIALIZE,
  INVALIDATE_SESSION,
  RESTORE,
  RESTORE_FAILED
} from './actionTypes'

export const authenticate = (authenticator, payload) => ({
  type: AUTHENTICATE,
  meta: { authenticator },
  payload
})

export const authenticateSucceeded = (authenticator, payload) => ({
  type: AUTHENTICATE_SUCCEEDED,
  meta: { authenticator },
  payload
})

export const authenticateFailed = payload => ({
  type: AUTHENTICATE_FAILED,
  payload
})

export const fetch = (url, options) => ({
  type: FETCH,
  payload: { url, options }
})

export const invalidateSession = () => ({
  type: INVALIDATE_SESSION
})

export const restore = payload => ({
  type: RESTORE,
  payload
})

export const restoreFailed = () => ({
  type: RESTORE_FAILED
})

export const initialize = payload => ({
  type: INITIALIZE,
  payload
})

import {
  AUTHENTICATE,
  AUTHENTICATE_FAILED,
  AUTHENTICATE_SUCCEEDED,
  FETCH,
  INITIALIZE,
  INVALIDATE_SESSION,
  UPDATE_SESSION,
  RESTORE,
  RESTORE_FAILED
} from './actionTypes'

export const authenticate = (authenticator, payload) => ({
  type: AUTHENTICATE,
  meta: { authenticator },
  payload
})

export const authenticateSucceeded = (authenticator, payload) => ({
  type: AUTHENTICATE_SUCCEEDED,
  meta: { authenticator },
  payload
})

export const authenticateFailed = payload => ({
  type: AUTHENTICATE_FAILED,
  payload
})

export const fetch = (url, options) => ({
  type: FETCH,
  payload: { url, options }
})

export const invalidateSession = () => ({
  type: INVALIDATE_SESSION
})

export const updateSession = payload => ({
  type: UPDATE_SESSION,
  payload
})

export const restore = payload => ({
  type: RESTORE,
  payload
})

export const restoreFailed = () => ({
  type: RESTORE_FAILED
})

export const initialize = payload => ({
  type: INITIALIZE,
  payload
})

Add updateSession action creator