trackTimeDuration.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { API_FAST_PLANS, API_FAST_CHECKS,API_FAST_CLOCKS, API_CLOCK_RECORDS } from './http/api'
  2. import { request } from './http/request';
  3. export const getPlans = () => {
  4. return new Promise((resolve) => {
  5. request({
  6. url: API_FAST_PLANS, method: 'GET', data: {}
  7. }).then(res => {
  8. resolve(res);
  9. console.log(res);
  10. // dispatch(loginSuccess(res));
  11. })
  12. })
  13. }
  14. export const setPlan = (params: Record<string, any> | undefined) => {
  15. return new Promise((resolve) => {
  16. request({
  17. url: API_FAST_PLANS, method: 'POST', data: { ...params }
  18. }).then(res => {
  19. resolve(res);
  20. console.log(res);
  21. // dispatch(loginSuccess(res));
  22. })
  23. })
  24. }
  25. export const getChecks = () => {
  26. return new Promise((resolve) => {
  27. request({
  28. url: API_FAST_CHECKS, method: 'GET', data: {}
  29. }).then(res => {
  30. resolve(res);
  31. })
  32. })
  33. }
  34. export const getClocks = () => {
  35. return new Promise((resolve) => {
  36. request({
  37. url: API_FAST_CLOCKS, method: 'GET', data: {}
  38. }).then(res => {
  39. resolve(res);
  40. })
  41. })
  42. }
  43. export const getClockRecords = (params:any)=>{
  44. return new Promise((resolve) => {
  45. request({
  46. url: API_CLOCK_RECORDS, method: 'GET', data: {...params}
  47. }).then(res => {
  48. resolve(res);
  49. })
  50. })
  51. }
  52. export const recordCheck = (params: Record<string, any> | undefined) => {
  53. return new Promise((resolve) => {
  54. request({
  55. url: API_FAST_CLOCKS, method: 'POST', data: { ...params }
  56. }).then(res => {
  57. resolve(res);
  58. })
  59. })
  60. }
  61. export const delRecord = (id: string) => {
  62. return new Promise((resolve) => {
  63. request({
  64. url: API_CLOCK_RECORDS + '/' + id, method: 'DELETE', data: {}
  65. }).then(res => {
  66. resolve(res);
  67. })
  68. })
  69. }