WIP: API with 401
This commit is contained in:
18
src/api/posts.api.js
Normal file
18
src/api/posts.api.js
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user