logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

pleroma.js (2412B)


  1. import api from '../api';
  2. export const TOS_FETCH_REQUEST = 'TOS_FETCH_REQUEST';
  3. export const TOS_FETCH_SUCCESS = 'TOS_FETCH_SUCCESS';
  4. export const TOS_FETCH_FAIL = 'TOS_FETCH_FAIL';
  5. export const PANEL_FETCH_REQUEST = 'PANEL_FETCH_REQUEST';
  6. export const PANEL_FETCH_SUCCESS = 'PANEL_FETCH_SUCCESS';
  7. export const PANEL_FETCH_FAIL = 'PANEL_FETCH_FAIL';
  8. export const PLEROMA_CONFIG_FETCH_REQUEST = 'PLEROMA_CONFIG_FETCH_REQUEST';
  9. export const PLEROMA_CONFIG_FETCH_SUCCESS = 'PLEROMA_CONFIG_FETCH_SUCCESS';
  10. export const PLEROMA_CONFIG_FETCH_FAIL = 'PLEROMA_CONFIG_FETCH_FAIL';
  11. export function fetchTOS() {
  12. return (dispatch, getState) => {
  13. dispatch(fetchTOSRequest());
  14. api(getState).get('/static/terms-of-service.html').then(response => {
  15. dispatch(fetchTOSSuccess(response.data));
  16. }).catch(error => {
  17. dispatch(fetchTOSFail(error));
  18. });
  19. };
  20. };
  21. export function fetchPanel() {
  22. return (dispatch, getState) => {
  23. dispatch(fetchPanelRequest());
  24. api(getState).get('/instance/panel.html').then(response => {
  25. dispatch(fetchPanelSuccess(response.data));
  26. }).catch(error => {
  27. dispatch(fetchPanelFail(error));
  28. });
  29. };
  30. };
  31. export function fetchPleromaConfig() {
  32. return (dispatch, getState) => {
  33. dispatch(fetchPleromaConfigRequest());
  34. api(getState).get('/static/config.json').then(response => {
  35. dispatch(fetchPleromaConfigSuccess(response.data));
  36. }).catch(error => {
  37. dispatch(fetchPleromaConfigFail(error));
  38. });
  39. };
  40. };
  41. export function fetchTOSRequest() {
  42. return {
  43. type: TOS_FETCH_REQUEST,
  44. };
  45. };
  46. export function fetchTOSSuccess(tos) {
  47. return {
  48. type: TOS_FETCH_SUCCESS,
  49. tos,
  50. };
  51. };
  52. export function fetchTOSFail(error) {
  53. return {
  54. type: TOS_FETCH_FAIL,
  55. error,
  56. };
  57. };
  58. export function fetchPanelRequest() {
  59. return {
  60. type: PANEL_FETCH_REQUEST,
  61. };
  62. };
  63. export function fetchPanelSuccess(panel) {
  64. return {
  65. type: PANEL_FETCH_SUCCESS,
  66. panel,
  67. };
  68. };
  69. export function fetchPanelFail(error) {
  70. return {
  71. type: PANEL_FETCH_FAIL,
  72. error,
  73. };
  74. };
  75. export function fetchPleromaConfigRequest() {
  76. return {
  77. type: PLEROMA_CONFIG_FETCH_REQUEST,
  78. };
  79. };
  80. export function fetchPleromaConfigSuccess(config) {
  81. return {
  82. type: PLEROMA_CONFIG_FETCH_SUCCESS,
  83. config,
  84. };
  85. };
  86. export function fetchPleromaConfigFail(error) {
  87. return {
  88. type: PLEROMA_CONFIG_FETCH_FAIL,
  89. error,
  90. };
  91. };