mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
working images in the database
This commit is contained in:
1 parent
997f550aab
commit
9e40fb8010
15 files changed
+157
-128
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent";
|
||||
import { useSetRecoilState } from "recoil";
|
||||
|
||||
import { IMAGE_DELIMITER } from "../utils/images";
|
||||
import types from "../types";
|
||||
import { twitterState } from "./state";
|
||||
import { useTweets } from "./useTweets";
|
||||
@@ -15,7 +16,20 @@ export const useTwitterService = () => {
|
||||
setCreateLoading(false); // on any result we should set loading to false
|
||||
};
|
||||
|
||||
useNuiEvent(types.APP_TWITTER, "fetchTweets", setTweets);
|
||||
const _setTweets = (tweets) => {
|
||||
setTweets(
|
||||
tweets.map((tweet) => {
|
||||
return {
|
||||
...tweet,
|
||||
// we store images in the database as a varchar field with
|
||||
// comma separated links to images
|
||||
images: tweet.images ? tweet.images.split(IMAGE_DELIMITER) : [],
|
||||
};
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
useNuiEvent(types.APP_TWITTER, "fetchTweets", _setTweets);
|
||||
useNuiEvent(types.APP_TWITTER, "createTweetLoading", setCreateLoading);
|
||||
useNuiEvent(types.APP_TWITTER, "createTweetResult", _setCreateSuccess);
|
||||
|
||||
|
||||
Reference in new issue
Block a user