mirror of
https://github.com/pinry/pinry.git
synced 2025-11-16 18:05:51 +01:00
Feature: Add brikcs js on home page
This commit is contained in:
committed by
Isaac Bythewood
parent
07dfa81a89
commit
932d0a673d
23
pinry-spa/src/components/api.js
Normal file
23
pinry-spa/src/components/api.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const API_PREFIX = '/api/v2/';
|
||||
|
||||
function fetchPins(offset, tagFilter, userFilter) {
|
||||
const url = `${API_PREFIX}pins/`;
|
||||
const queryArgs = {
|
||||
format: 'json',
|
||||
ordering: '-id',
|
||||
limit: 50,
|
||||
offset,
|
||||
};
|
||||
if (tagFilter) queryArgs.tags__name = tagFilter;
|
||||
if (userFilter) queryArgs.submitter__username = userFilter;
|
||||
return axios.get(
|
||||
url,
|
||||
{ params: queryArgs },
|
||||
);
|
||||
}
|
||||
|
||||
export default {
|
||||
fetchPins,
|
||||
};
|
||||
Reference in New Issue
Block a user