mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
Update useGetRssFeed to use ids
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { defineWidget } from '../helper';
|
||||||
|
import { IWidget } from '../widgets';
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Badge,
|
Badge,
|
||||||
@@ -29,8 +31,6 @@ import dayjs from 'dayjs';
|
|||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { defineWidget } from '../helper';
|
|
||||||
import { IWidget } from '../widgets';
|
|
||||||
|
|
||||||
const definition = defineWidget({
|
const definition = defineWidget({
|
||||||
id: 'rss',
|
id: 'rss',
|
||||||
@@ -56,11 +56,11 @@ interface RssTileProps {
|
|||||||
widget: IRssWidget;
|
widget: IRssWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
const useGetRssFeed = (feedUrl: string) =>
|
export const useGetRssFeed = (feedUrl: string, widgetId: string) =>
|
||||||
useQuery({
|
useQuery({
|
||||||
queryKey: ['rss-feed', feedUrl],
|
queryKey: ['rss-feed', feedUrl],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const response = await fetch('/api/modules/rss');
|
const response = await fetch(`/api/modules/rss?widgetId=${widgetId}`);
|
||||||
return response.json();
|
return response.json();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user