Commit 2b932bed authored by Jure's avatar Jure

Merge branch 'action-names-client' into 'master'

Define login and logout action names in core

Closes #33

See merge request !110
parents f5624a13 4f226ca0
Pipeline #2623 passed with stage
in 1 minute and 39 seconds
......@@ -82,3 +82,13 @@ export const FILE_UPLOAD_FAILURE = 'FILE_UPLOAD_FAILURE'
export const RESET_ERROR_MESSAGE = 'RESET_ERROR_MESSAGE'
export const HYDRATE = 'HYDRATE'
// The following actions are implemented elsewhere in pubsweet components
export const LOGIN_REQUEST = 'LOGIN_REQUEST'
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS'
export const LOGIN_FAILURE = 'LOGIN_FAILURE'
export const LOGOUT_REQUEST = 'LOGOUT_REQUEST'
export const LOGOUT_SUCCESS = 'LOGOUT_SUCCESS'
export const LOGOUT_FAILURE = 'LOGOUT_FAILURE'
......@@ -9,11 +9,10 @@ import {
DELETE_COLLECTION_SUCCESS,
GET_FRAGMENTS_SUCCESS,
CREATE_FRAGMENT_SUCCESS,
DELETE_FRAGMENT_SUCCESS
DELETE_FRAGMENT_SUCCESS,
LOGOUT_SUCCESS
} from '../actions/types'
import { LOGOUT_SUCCESS } from 'pubsweet-component-login/types'
import find from 'lodash/find'
import union from 'lodash/union'
import difference from 'lodash/difference'
......
import {
GET_CURRENT_USER_REQUEST, GET_CURRENT_USER_SUCCESS, GET_CURRENT_USER_FAILURE
GET_CURRENT_USER_REQUEST,
GET_CURRENT_USER_SUCCESS,
GET_CURRENT_USER_FAILURE,
LOGOUT_SUCCESS
} from '../actions/types'
import { LOGOUT_SUCCESS } from 'pubsweet-component-login/types'
export default function (state = {
isFetching: false,
isAuthenticated: false
......
......@@ -10,11 +10,10 @@ import {
// UPDATE_FRAGMENT_FAILURE,
DELETE_FRAGMENT_REQUEST,
DELETE_FRAGMENT_FAILURE,
DELETE_FRAGMENT_SUCCESS
DELETE_FRAGMENT_SUCCESS,
LOGOUT_SUCCESS
} from '../actions/types'
import { LOGOUT_SUCCESS } from 'pubsweet-component-login/types'
import clone from 'lodash/clone'
import unset from 'lodash/unset'
......
......@@ -2,11 +2,10 @@ import {
GET_TEAMS_SUCCESS,
CREATE_TEAM_SUCCESS,
UPDATE_TEAM_SUCCESS,
DELETE_TEAM_SUCCESS
DELETE_TEAM_SUCCESS,
LOGOUT_SUCCESS
} from '../actions/types'
import { LOGOUT_SUCCESS } from 'pubsweet-component-login/types'
import clone from 'lodash/clone'
import findIndex from 'lodash/findIndex'
import difference from 'lodash/difference'
......
......@@ -6,11 +6,10 @@ import {
GET_USER_SUCCESS,
UPDATE_USER_REQUEST,
UPDATE_USER_SUCCESS,
GET_CURRENT_USER_SUCCESS
GET_CURRENT_USER_SUCCESS,
LOGOUT_SUCCESS
} from '../actions/types'
import { LOGOUT_SUCCESS } from 'pubsweet-component-login/types'
// TODO: store users as an object/map instead of an array
// The users reducer.
......
......@@ -2,7 +2,6 @@ const allReducers = require('../../src/reducers').default
const reducer = require('../../src/reducers/collections').default
const T = require('../../src/actions/types')
const { LOGOUT_SUCCESS } = require('pubsweet-component-login/types')
describe('collections reducers', () => {
it('is exported in the all reducers object', () => {
......@@ -99,7 +98,7 @@ describe('collections reducers', () => {
it('logout success', () => {
const actual = reducer([mockCollectionWithFragment], {
type: LOGOUT_SUCCESS
type: T.LOGOUT_SUCCESS
})
expect(actual).toEqual([])
})
......
......@@ -2,7 +2,6 @@ const allReducers = require('../../src/reducers').default
const reducer = require('../../src/reducers/currentUser').default
const T = require('../../src/actions/types')
const {LOGOUT_SUCCESS} = require('pubsweet-component-login/types')
describe('currentUser reducers', () => {
it('is exported in the all reducers object', () => {
......@@ -43,7 +42,7 @@ describe('currentUser reducers', () => {
const actual = reducer({
user: mockuser
}, {
type: LOGOUT_SUCCESS
type: T.LOGOUT_SUCCESS
})
expect(actual).toEqual({
isFetching: false,
......
......@@ -2,7 +2,6 @@ const allReducers = require('../../src/reducers').default
const reducer = require('../../src/reducers/fragments').default
const T = require('../../src/actions/types')
const {LOGOUT_SUCCESS} = require('pubsweet-component-login/types')
const clone = require('lodash/clone')
......@@ -80,7 +79,7 @@ describe('fragments reducers', () => {
it('logout success', () => {
const actual = reducer(mockstate, {
type: LOGOUT_SUCCESS
type: T.LOGOUT_SUCCESS
})
expect(actual).toEqual({})
})
......
......@@ -2,7 +2,6 @@ const allReducers = require('../../src/reducers').default
const reducer = require('../../src/reducers/teams').default
const T = require('../../src/actions/types')
const {LOGOUT_SUCCESS} = require('pubsweet-component-login/types')
describe('teams reducers', () => {
it('is exported in the all reducers object', () => {
......@@ -47,7 +46,7 @@ describe('teams reducers', () => {
it('logout success', () => {
const actual = reducer(mockstate, {
type: LOGOUT_SUCCESS
type: T.LOGOUT_SUCCESS
})
expect(actual).toEqual([])
})
......
......@@ -4,7 +4,6 @@ const allReducers = require('../../src/reducers').default
const reducer = require('../../src/reducers/users').default
const T = require('../../src/actions/types')
const {LOGOUT_SUCCESS} = require('pubsweet-component-login/types')
describe('users reducers', () => {
it('is exported in the all reducers object', () => {
......@@ -78,7 +77,7 @@ describe('users reducers', () => {
it('logout success', () => {
const actual = reducer(mockstate, {
type: LOGOUT_SUCCESS,
type: T.LOGOUT_SUCCESS,
user: usermod
})
expect(actual).toEqual({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment