Skip to content

Commit

Permalink
Testing if query correctly returns 404 to client.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martinsos committed Jul 24, 2024
1 parent 5a92e37 commit 10d7e77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/thoughts/src/client/ThoughtsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ const ThoughtsPage = (props) => {
const tag = queryParams.get('tag')

// TODO: Handle possible errors and fetching.
const { data: thoughts } = useQuery(getThoughts, { tagName: tag })
const { error, status, data: thoughts } = useQuery(getThoughts, { tagName: tag })

console.log('Error: ' + JSON.stringify(error));

return (
<Layout
user={props.user}
activeTag={tag || '_all'}
>
<div className="center-container">
Status: {status}
<ThoughtsList thoughts={thoughts} />
</div>
</Layout>
Expand Down
1 change: 1 addition & 0 deletions examples/thoughts/src/server/queries.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HttpError } from "wasp/server";

export const getThoughts = async (args, context) => {
throw new HttpError(404);
if (!context.user) { throw new HttpError(403) }

return context.entities.Thought.findMany({
Expand Down

0 comments on commit 10d7e77

Please sign in to comment.