WIP: API with 401

This commit is contained in:
Pete Gerlach
2024-06-10 00:55:13 +02:00
parent f36ea7a34b
commit 743bb06c00
6 changed files with 52 additions and 42 deletions

18
src/api/posts.api.js Normal file
View File

@@ -0,0 +1,18 @@
import axios from "axios"
const path = "https://api.jodel.anxietyprime.de/post";
const config = {
headers: {
auth: {
username: process.env.REACT_APP_AUTH_USERNAME,
password: process.env.REACT_APP_AUTH_PASSWORD,
}
}
}
export const postApi = {
async getPostsByCoords (lon, lat) {
return (await axios.get(`${path}/${lon}/${lat}`, this.config)).data;
}
}