Spaces:
Build error
Build error
| import axios from 'axios' | |
| const BASE = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000' | |
| const client = axios.create({ baseURL: BASE, withCredentials: true }) | |
| export const initiateLogin = () => { | |
| window.location.href = `${BASE}/auth/login` | |
| } | |
| export const initiateLogout = () => { | |
| window.location.href = `${BASE}/auth/logout` | |
| } | |
| export async function getCurrentUser() { | |
| const r = await client.get('/auth/user') | |
| return r.data | |
| } | |
| export async function recommend(user_id, content_id, algorithm = 'linucb') { | |
| const r = await client.post('/recommend', { user_id, content_id, algorithm }) | |
| return r.data | |
| } | |
| export async function feedback(impression_id, reward) { | |
| const r = await client.post('/feedback', { impression_id, reward }) | |
| return r.data | |
| } | |
| export async function stats() { | |
| const r = await client.get('/stats') | |
| return r.data | |
| } | |
| export async function getUsers() { | |
| const r = await client.get('/users') | |
| return r.data | |
| } | |
| export async function getContents() { | |
| const r = await client.get('/contents') | |
| return r.data | |
| } | |