helper.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: 'space-shuttle',
  17. hexcolor: '#7d4e24',
  18. creationLabel: 'Create a workspace',
  19. domContainer: 'appFeatureContainer'
  20. }
  21. export const PAGE = {
  22. HOME: '/',
  23. WORKSPACE: {
  24. DASHBOARD: (idws = ':idws') => `/workspaces/${idws}/dashboard`,
  25. NEW: (idws, type) => `/workspaces/${idws}/${type}/new`,
  26. CALENDAR: (idws = ':idws') => `/workspaces/${idws}/calendar`,
  27. CONTENT_LIST: (idws = ':idws') => `/workspaces/${idws}/contents`,
  28. CONTENT: (idws = ':idws', type = ':type?', idcts = ':idcts?') => `/workspaces/${idws}/${type}/${idcts}`, // @TODO add /contents/ in url and remove <Switch> in <Tracim>
  29. // CONTENT_NEW: (idws = ':idws', ctstype = ':ctstype') => `/workspaces/${idws}/contents/${ctstype}/new`,
  30. // CONTENT_EDIT: (idws = ':idws', idcts = ':idcts') => `/workspaces/${idws}/contents/${idcts}/edit`,
  31. // CONTENT_TITLE_EDIT: (idws = ':idws', idcts = ':idcts') => `/workspaces/${idws}/contents/${idcts}/title/edit`,
  32. ADMIN: (idws = ':idws') => `/workspaces/${idws}/admin`
  33. },
  34. LOGIN: '/login',
  35. ACCOUNT: '/account',
  36. ADMIN: {
  37. ROOT: '/admin',
  38. WORKSPACE: '/admin/workspace',
  39. USEr: '/admin/user'
  40. }
  41. }
  42. export const ROLE = [{
  43. id: 0,
  44. name: 'reader',
  45. icon: 'fa-eye',
  46. translationKey: 'role.reader'
  47. }, {
  48. id: 1,
  49. name: 'contributor',
  50. icon: 'fa-pencil',
  51. translationKey: 'role.contributor'
  52. }, {
  53. id: 2,
  54. name: 'content_manager',
  55. icon: 'fa-graduation-cap',
  56. translationKey: 'role.content_manager'
  57. }, {
  58. id: 3,
  59. name: 'manager',
  60. icon: 'fa-gavel',
  61. translationKey: 'role.manager'
  62. }]
  63. export const handleRouteFromApi = route => route.startsWith('/#') ? route.slice(2) : route