helper.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. export const FETCH_CONFIG = {
  2. headers: {
  3. 'Accept': 'application/json',
  4. 'Content-Type': 'application/json'
  5. },
  6. apiUrl: 'http://localhost:6543/api/v2',
  7. mockApiUrl: 'http://localhost:3001' // @todo: better to use one url only and use proxy on mock api to point to real api (if implemented)
  8. }
  9. export const COOKIE = {
  10. USER_LOGIN: 'user_login',
  11. USER_AUTH: 'user_auth'
  12. }
  13. // Côme - 2018/08/02 - shouldn't this come from api ?
  14. export const workspaceConfig = {
  15. slug: 'workspace',
  16. faIcon: 'bank',
  17. hexcolor: '#7d4e24',
  18. creationLabel: 'Create a workspace',
  19. domContainer: 'appFeatureContainer'
  20. }
  21. export const PAGE = {
  22. HOME: '/',
  23. WORKSPACE: {
  24. ROOT: '/workspaces',
  25. DASHBOARD: (idws = ':idws') => `/workspaces/${idws}/dashboard`,
  26. NEW: (idws, type) => `/workspaces/${idws}/contents/${type}/new`,
  27. CALENDAR: (idws = ':idws') => `/workspaces/${idws}/calendar`,
  28. CONTENT_LIST: (idws = ':idws') => `/workspaces/${idws}/contents`,
  29. CONTENT: (idws = ':idws', type = ':type', idcts = ':idcts') => `/workspaces/${idws}/contents/${type}/${idcts}`,
  30. ADMIN: (idws = ':idws') => `/workspaces/${idws}/admin`
  31. },
  32. LOGIN: '/login',
  33. ACCOUNT: '/account',
  34. ADMIN: {
  35. ROOT: '/admin',
  36. WORKSPACE: '/admin/workspace',
  37. USER: '/admin/user'
  38. }
  39. }
  40. export const ROLE = [{
  41. id: 0,
  42. slug: 'reader',
  43. faIcon: 'eye',
  44. hexcolor: '#15D948',
  45. label: 'Reader'
  46. }, {
  47. id: 1,
  48. slug: 'contributor',
  49. faIcon: 'pencil',
  50. hexcolor: '#3145F7',
  51. label: 'Contributor'
  52. }, {
  53. id: 2,
  54. slug: 'content-manager',
  55. faIcon: 'graduation-cap',
  56. hexcolor: '#f2af2d',
  57. label: 'Content manager'
  58. }, {
  59. id: 3,
  60. slug: 'workspace-manager',
  61. faIcon: 'gavel',
  62. hexcolor: '#ed0007',
  63. label: 'Workspace manager'
  64. }]
  65. export const PROFILE = {
  66. ADMINISTRATOR: 'administrators',
  67. USER: 'users'
  68. }
  69. export const handleRouteFromApi = route => route.startsWith('/#') ? route.slice(2) : route