1 | import axios from "../custom-axios/axios";
|
---|
2 |
|
---|
3 | const RebuService = {
|
---|
4 | tipDriver: (paymentId, driverTipSum) => {
|
---|
5 | return axios.post(`/payment/${paymentId}/tip`, null, { params: {
|
---|
6 | driverTipSum
|
---|
7 | }
|
---|
8 | })
|
---|
9 | },
|
---|
10 | changeProfilePicture: (driverId, profilePicture) => {
|
---|
11 | return axios.post(`/driver/${driverId}/profile/picture`, profilePicture);
|
---|
12 | },
|
---|
13 | downloadPassengerReport: (passengerId) => {
|
---|
14 | return axios.get(`/reports/download/passenger/${passengerId}`,{
|
---|
15 | responseType: "blob",
|
---|
16 | });
|
---|
17 | },
|
---|
18 | downloadDriverReport: (driverId) => {
|
---|
19 | return axios.get(`/reports/download/driver/${driverId}`,{
|
---|
20 | responseType: "blob",
|
---|
21 | });
|
---|
22 | },
|
---|
23 | downloadAdminReport: () => {
|
---|
24 | return axios.get(`/reports/download/admin`,{
|
---|
25 | responseType: "blob",
|
---|
26 | });
|
---|
27 | },
|
---|
28 | getAdminReport: () => {
|
---|
29 | return axios.get("/reports/admin")
|
---|
30 | },
|
---|
31 | getDriverReport: (driverId) => {
|
---|
32 | return axios.get(`/reports/driver/${driverId}`)
|
---|
33 | },
|
---|
34 | getPassengerReport: (passengerId) => {
|
---|
35 | return axios.get(`/reports/passenger/${passengerId}`)
|
---|
36 | },
|
---|
37 | addCarForDriver: (driverId, licensePlate, make, model, year) => {
|
---|
38 | return axios.post(`/car/add/${driverId}`, {
|
---|
39 | "licensePlate" : licensePlate,
|
---|
40 | "make" : make,
|
---|
41 | "model" : model,
|
---|
42 | "year": year
|
---|
43 | })
|
---|
44 | },
|
---|
45 | approveDriver: (driverId) => {
|
---|
46 | return axios.post(`/driver/approve/${driverId}`)
|
---|
47 | },
|
---|
48 | denyDriver: (driverId) => {
|
---|
49 | return axios.post(`/driver/deny/${driverId}`)
|
---|
50 | },
|
---|
51 | getDriverById: (driverId) => {
|
---|
52 | return axios.get(`/driver/${driverId}`)
|
---|
53 | },
|
---|
54 | getAllDrivers: () => {
|
---|
55 | return axios.get("/driver")
|
---|
56 | },
|
---|
57 | getUnapprovedDrivers: () => {
|
---|
58 | return axios.get("/driver/unapproved")
|
---|
59 | },
|
---|
60 | getAllCreatedRequests: (driverId) => {
|
---|
61 | return axios.get(`/request/driver/${driverId}`)
|
---|
62 | },
|
---|
63 | getAllPayments: () => {
|
---|
64 | return axios.get("/payment")
|
---|
65 | },
|
---|
66 | registerPassenger: (firstName, surname, email, password) => {
|
---|
67 | return axios.post("/public/register/passenger", {
|
---|
68 | "email" : email,
|
---|
69 | "password" : password,
|
---|
70 | "name" : firstName,
|
---|
71 | "surname" : surname,
|
---|
72 | })
|
---|
73 | },
|
---|
74 | registerDriver: (firstName, surname, email, password, pricePerKm) => {
|
---|
75 | return axios.post("/public/register/driver", {
|
---|
76 | "email" : email,
|
---|
77 | "password" : password,
|
---|
78 | "name" : firstName,
|
---|
79 | "surname" : surname,
|
---|
80 | "pricePerKm" : pricePerKm
|
---|
81 | })
|
---|
82 | },
|
---|
83 | login: (username, password) => {
|
---|
84 | return axios.post("/public/login", {
|
---|
85 | "email": username,
|
---|
86 | "password": password
|
---|
87 | });
|
---|
88 | },
|
---|
89 |
|
---|
90 | }
|
---|
91 |
|
---|
92 | export default RebuService; |
---|