React app
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

45 rader
1.2 KiB

  1. import axios from "axios";
  2. import { API_TOKEN, SERVER_URL } from "../App";
  3. import { viewPermissionType } from "../shared/models/variables";
  4. export const getShelfDetails = async (categoryId: string) => {
  5. return await axios.get(SERVER_URL + '/shelf/details/?_id=' + categoryId,
  6. {
  7. headers: API_TOKEN
  8. })
  9. }
  10. export const addShelf = async (categoryId: string, name: string, isArchived: boolean, viewType: viewPermissionType, description?: string) => {
  11. return await axios.post(SERVER_URL + '/shelf/add/',
  12. {
  13. categoryId: categoryId,
  14. name: name,
  15. description: description,
  16. isArchived: isArchived,
  17. viewType: viewType
  18. },
  19. {
  20. headers: API_TOKEN
  21. })
  22. }
  23. //Need to be discussed
  24. export const updateShelf = async (id: string, word: string, isArchived: boolean, spaceBetweenRecall: number) => {
  25. return await axios.put(SERVER_URL + '/shelf/update/',
  26. {
  27. id: id,
  28. words: [{
  29. word: word,
  30. notes: [],
  31. isArchived: isArchived,
  32. spaceBetweenRecall: spaceBetweenRecall
  33. }]
  34. },
  35. {
  36. headers: API_TOKEN
  37. })
  38. }