Skip to content

Commit

Permalink
Fix filtering directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Jan 9, 2021
1 parent 9107698 commit c65a5bd
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# **Aruppi API** (v3.3.2)
# **Aruppi API** (v3.3.3)

> This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture
>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aruppi",
"version": "3.3.2",
"version": "3.3.3",
"description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app",
"main": "./src/api/api.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ const getAllAnimes = async () =>{

};

const getAllDirectory = async (notNSWF) =>{
const getAllDirectory = async (genres) =>{

let data
if (notNSWF) {
if (genres === "sfw") {
data = JSON.parse(JSON.stringify(require('../assets/directory.json'))).filter(function (item) {
return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi");
})
Expand Down
6 changes: 3 additions & 3 deletions src/api/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ router.get('/allAnimes' , (req, res) =>{

});

router.get('/allDirectory/:notNSWF?' , (req, res) =>{
router.get('/allDirectory/:genres?' , (req, res) =>{

let notNSWF = req.params.notNSWF;
api.getAllDirectory(notNSWF)
let genres = req.params.genres;
api.getAllDirectory(genres)
.then(directory =>{
if (directory.length > 0) {
res.status(200).json({
Expand Down
2 changes: 1 addition & 1 deletion src/v2/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const getAllAnimes = async () =>{

};

const getAllDirectory = async (notNSWF) =>{ return await getDirectory(notNSWF); };
const getAllDirectory = async (genres) =>{ return await getDirectory(genres); };

const getAnitakume = async () =>{

Expand Down
6 changes: 3 additions & 3 deletions src/v2/api/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ router.get('/allAnimes' , (req, res) =>{

});

router.get('/allDirectory/:notNSWF?' , (req, res) =>{
router.get('/allDirectory/:genres?' , (req, res) =>{

let notNSWF = req.params.notNSWF;
let genres = req.params.genres;

api.getAllDirectory(notNSWF)
api.getAllDirectory(genres)
.then(directory =>{
if (directory.length > 0) {
res.status(200).json({
Expand Down
4 changes: 2 additions & 2 deletions src/v2/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ const getThemes = async (themes) => {

const getAnimes = async () => await homgot(`${BASE_ANIMEFLV}api/animes/list`, { parse: true });

const getDirectory = async (notNSWF) => {
const getDirectory = async (genres) => {

let data
if (notNSWF) {
if (genres === "sfw") {
data = JSON.parse(JSON.stringify(require('../../assets/directory.json'))).filter(function (item) {
return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi");
})
Expand Down

0 comments on commit c65a5bd

Please sign in to comment.