mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
auto refresh working
This commit is contained in:
1 parent
ba0f122938
commit
997f550aab
4 files changed
+14
-7
No files matched your search
@@ -1,12 +1,23 @@
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
import Nui from "../../../os/nui-events/utils/Nui";
|
||||
import { List } from "../../../ui/components/List";
|
||||
import { useTweets } from "../hooks/useTweets";
|
||||
import Tweet from "./Tweet";
|
||||
|
||||
const TWEETS_REFRESH_RATE = 5000;
|
||||
|
||||
export function TweetList() {
|
||||
const { tweets } = useTweets();
|
||||
console.log(tweets);
|
||||
|
||||
useEffect(() => {
|
||||
Nui.send("phone:fetchTweets", {});
|
||||
const timeout = window.setTimeout(() => {
|
||||
Nui.send("phone:fetchTweets", {});
|
||||
}, TWEETS_REFRESH_RATE);
|
||||
return () => window.clearTimeout(timeout);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<List>
|
||||
{tweets
|
||||
|
||||
Reference in new issue
Block a user