diff --git a/client/src/api/posts.js b/client/src/api/posts.js
index 7202645..b5a9338 100644
--- a/client/src/api/posts.js
+++ b/client/src/api/posts.js
@@ -9,9 +9,11 @@ export const getPosts = async (cursor, limit) => {
}
}
-export const searchPosts = async (query) => {
+export const searchPosts = async (query, cursor, limit) => {
try {
- const { data } = await api.get('/posts/search', { params: { query } })
+ const { data } = await api.get('/posts/search', {
+ params: { query, cursor, limit }
+ })
return data
} catch (error) {
throw handleApiError(error)
diff --git a/client/src/api/tags.js b/client/src/api/tags.js
index 06140be..6fb2cc3 100644
--- a/client/src/api/tags.js
+++ b/client/src/api/tags.js
@@ -17,3 +17,14 @@ export const searchTags = async (q) => {
throw handleApiError(error)
}
}
+
+export const searchPostsByTags = async (tag, cursor, limit) => {
+ try {
+ const { data } = await api.get(`/tags/posts/${tag}`, {
+ params: { cursor, limit }
+ })
+ return data
+ } catch (error) {
+ throw handleApiError(error)
+ }
+}
diff --git a/client/src/components/AccountMenu.jsx b/client/src/components/AccountMenu.jsx
index e94b2ee..eef406e 100644
--- a/client/src/components/AccountMenu.jsx
+++ b/client/src/components/AccountMenu.jsx
@@ -20,10 +20,21 @@ import { Link } from 'react-router'
import { useTheme } from '@/hooks'
import { useState } from 'react'
import { UserAvatar } from '.'
+import { useStore } from '@/store'
const AccountMenuItems = ({ handleClose, handleClick, open }) => {
- const { user } = useUser()
+ const { user, sign } = useUser()
const { signOut } = useAuth()
+ const { openSnackbar } = useStore()
+
+ const logOut = () => {
+ try {
+ signOut()
+ openSnackbar('Logged in successfully')
+ } catch (error) {
+ openSnackbar(error.message, 'error')
+ }
+ }
return (
<>
@@ -52,7 +63,7 @@ const AccountMenuItems = ({ handleClose, handleClick, open }) => {
-