lobehub/src/app/api/plugin/store/route.ts
Arvin Xu 3d56dd6a1a
♻️ refactor: refactor the db model (#1567)
* ♻️ refactor: refactor the db code

*  test: fix test

* ♻️ refactor: refactor the  user model
2024-03-14 20:20:09 +08:00

21 lines
510 B
TypeScript

import { DEFAULT_LANG } from '@/const/locale';
import { PluginStore } from './Store';
export const runtime = 'edge';
export const GET = async (req: Request) => {
const locale = new URL(req.url).searchParams.get('locale');
const pluginStore = new PluginStore();
let res: Response;
res = await fetch(pluginStore.getPluginIndexUrl(locale as any), { next: { revalidate: 3600 } });
if (res.status === 404) {
res = await fetch(pluginStore.getPluginIndexUrl(DEFAULT_LANG));
}
return res;
};