Servers API

This commit is contained in:
cracklesparkle
2024-07-09 11:58:45 +09:00
parent c74c911eea
commit 6f4aa1903d
26 changed files with 492 additions and 303 deletions

View File

@ -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)
}
}