added backend to cache manga updates requests
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"name": "mangastatus",
|
||||
"version": "0.0.0",
|
||||
"name": "mangastatus-frontend",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"author": "wea_ondara",
|
||||
"license": "ISC",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "run-p type-check \"build-only {@}\" --",
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {AniListMangaListCollection} from '@/data/models/anilist/AniListMang
|
||||
|
||||
export default class AniListApi {
|
||||
async fetchUser(userName: string): Promise<AniListUser> {
|
||||
const res = fetch('/graphql', {
|
||||
const res = fetch('/anilist/graphql', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -18,7 +18,7 @@ export default class AniListApi {
|
||||
}
|
||||
|
||||
async fetchManga(userId: number): Promise<AniListMangaListCollection> {
|
||||
const res = fetch('/graphql', {
|
||||
const res = fetch('/anilist/graphql', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -58,7 +58,7 @@ export default class MangaUpdatesDataService {
|
||||
}
|
||||
continue;
|
||||
} finally {
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
// await new Promise((r) => setTimeout(r, 1000));
|
||||
}
|
||||
matching = results.results
|
||||
.filter(e => stringSimilarity(title, e.record.title, 2, false) >= 0.95)
|
||||
|
||||
@@ -23,25 +23,14 @@ export default defineConfig({
|
||||
},
|
||||
clearScreen: false,
|
||||
server: {
|
||||
proxy: {
|
||||
'/graphql': {
|
||||
target: 'https://graphql.anilist.co',
|
||||
proxy: {//for dev
|
||||
'^/anilist/.*$': {
|
||||
target: 'http://localhost:5000',
|
||||
changeOrigin: true,
|
||||
configure: (proxy, options) => {
|
||||
proxy.on('proxyRes', proxyRes => {
|
||||
delete proxyRes.headers['set-cookie'];
|
||||
});
|
||||
},
|
||||
},
|
||||
'^/mangaupdates/.*$': {
|
||||
target: 'https://api.mangaupdates.com',
|
||||
target: 'http://localhost:5000',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/mangaupdates/, ''),
|
||||
configure: (proxy, options) => {
|
||||
proxy.on('proxyRes', proxyRes => {
|
||||
delete proxyRes.headers['set-cookie'];
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user