44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
import api from "./api";
|
|
|
|
export const request = {
|
|
sendCode: (mobile, captcha_token) =>
|
|
api.post(
|
|
"api/v1/user/send-code",
|
|
{
|
|
mobile,
|
|
captcha_token,
|
|
},
|
|
{
|
|
headers: {
|
|
Authorization: "",
|
|
},
|
|
}
|
|
),
|
|
getToken: (grant_type, client_id, client_secret, uuid, code) => {
|
|
const formData = new URLSearchParams();
|
|
formData.append("grant_type", grant_type);
|
|
formData.append("client_id", client_id);
|
|
formData.append("client_secret", client_secret);
|
|
formData.append("uuid", uuid);
|
|
formData.append("code", code);
|
|
|
|
return api.post("oauth/token", formData, {
|
|
headers: {
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
Authorization: "",
|
|
},
|
|
});
|
|
},
|
|
getUserProfile: (uuid) => api.get(`/api/v1/user-profile/${uuid}`),
|
|
postUserProfile: (data) => api.post("api/v1/user-profile", data),
|
|
patchUserProfile: (data, uuid) =>
|
|
api.patch(`api/v1/user-profile/${uuid}`, data),
|
|
getUserInfo: (headers) => api.get("oauth/userinfo", headers),
|
|
getInsuranceType: () =>
|
|
api.get("api/v1/categorys/insurance_type", {
|
|
headers: {
|
|
Authorization: "",
|
|
},
|
|
}),
|
|
};
|