forked from
rocksky.app/rocksky
A decentralized music tracking and discovery platform built on AT Protocol 馃幍
1import axios from "axios";
2import { API_URL } from "../consts";
3
4export const like = async (uri: string) => {
5 const response = await axios.post(
6 `${API_URL}/users/${uri.replace("at://", "")}/likes`,
7 {},
8 {
9 headers: {
10 "Content-Type": "application/json",
11 Authorization: `Bearer ${localStorage.getItem("token")}`,
12 },
13 },
14 );
15 return response.data;
16};
17export const unlike = async (uri: string) => {
18 const response = await axios.delete(
19 `${API_URL}/users/${uri.replace("at://", "")}/likes`,
20 {
21 headers: {
22 Authorization: `Bearer ${localStorage.getItem("token")}`,
23 },
24 },
25 );
26 return response.data;
27};
28export const getLikes = async (uri: string) => {
29 const response = await axios.get(
30 `${API_URL}/users/${uri.replace("at://", "")}/likes`,
31 );
32 return response.data;
33};