install and handle casle & prevent page dashboard & handle register and code verfication & get data in clinics page
This commit is contained in:
@@ -5,7 +5,6 @@ import "react-toastify/dist/ReactToastify.css";
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
const token = Cookies.get("access");
|
||||
console.log(token);
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: BASE_URL,
|
||||
@@ -17,11 +16,9 @@ const api = axios.create({
|
||||
|
||||
api.interceptors.response.use(
|
||||
(response) => {
|
||||
console.log(response);
|
||||
return response.data;
|
||||
},
|
||||
(error) => {
|
||||
console.error(error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
import api from "./api";
|
||||
|
||||
export const request = {
|
||||
sendCode: (mobile_number) =>
|
||||
sendCode: (mobile, captcha_token) =>
|
||||
api.post(
|
||||
"api/v1/user/auth",
|
||||
{ mobile_number },
|
||||
"api/v1/user/send-code",
|
||||
{
|
||||
mobile,
|
||||
captcha_token,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "",
|
||||
withCredentials: true,
|
||||
},
|
||||
}
|
||||
),
|
||||
getToken: (grant_type, client_id, client_secret, mobile_number, code) => {
|
||||
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("mobile_number", mobile_number);
|
||||
formData.append("uuid", uuid);
|
||||
formData.append("code", code);
|
||||
|
||||
return api.post("oauth/token", formData, {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
Authorization: "",
|
||||
withCredentials: true,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user