Skip to content

Commit 78ea6fa

Browse files
committed
fix(Composable): resolve issue with not showing cached data in post fetch function & modal
1 parent ac38473 commit 78ea6fa

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

src/composables/posts.composable.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ export default function useFetchPost() {
1010

1111
function fetchPost(id) {
1212
const cachedPosts = StorageService.get("cached-posts") || {};
13-
if (cachedPosts[`post-${id}`]) return cachedPosts[`post-${id}`];
14-
startLoading();
15-
return PostsServices.getOneById(id)
13+
14+
if (cachedPosts[`post-${id}`]) {
15+
post.value = cachedPosts[`post-${id}`];
16+
return
17+
}
18+
else{
19+
startLoading();
20+
return PostsServices.getOneById(id)
1621
.then((response) => {
1722
post.value = response.data;
1823
StorageService.set('cached-posts', { ...cachedPosts, [`post-${id}`]: response.data })
@@ -21,6 +26,7 @@ export default function useFetchPost() {
2126
.finally(() => {
2227
endLoading();
2328
});
29+
}
2430
}
2531

2632
return {

src/locales/en/messages.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@ export default {
4141
"System": "System",
4242
"Settings": "Settings",
4343
"Actions":"Actions",
44-
"EmailPlaceholder":"Email"
44+
"EmailPlaceholder":"Email",
45+
"Post":"Post",
46+
"Confirmed":"Confirmed"
4547
};

src/locales/fa/messages.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ export default {
4343
Settings: "تنظیمات",
4444
Actions: "عملیات",
4545
EmailPlaceholder: "Email",
46+
"Confirmed":"تایید شده"
4647
};

0 commit comments

Comments
 (0)