Servers API
This commit is contained in:
@ -1,19 +1,24 @@
|
||||
import axiosInstance, { axiosInstanceAuth } from "../http/axiosInstance";
|
||||
import { AxiosRequestConfig } from "axios";
|
||||
import { BASE_URL } from "../constants";
|
||||
import axiosInstance from "../http/axiosInstance";
|
||||
|
||||
const config: AxiosRequestConfig = {
|
||||
baseURL: BASE_URL.auth,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
|
||||
export default class AuthService {
|
||||
static async login(data: any) {
|
||||
return await axiosInstanceAuth.post(`/auth/login`, data, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
return await axiosInstance.post(`/auth/login`, data, config)
|
||||
}
|
||||
|
||||
static async refreshToken(token: string) {
|
||||
return await axiosInstanceAuth.post(`/auth/refresh_token/${token}`)
|
||||
return await axiosInstance.post(`/auth/refresh_token/${token}`, null, config)
|
||||
}
|
||||
|
||||
static async getCurrentUser(token: string) {
|
||||
return await axiosInstanceAuth.get(`/auth/get_current_user/${token}`)
|
||||
return await axiosInstance.get(`/auth/get_current_user/${token}`, config)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user