Skip to content

Commit

Permalink
fix auth
Browse files Browse the repository at this point in the history
  • Loading branch information
potts99 committed Nov 29, 2023
1 parent 85e80e5 commit 3f480c8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 7 additions & 1 deletion apps/client/layouts/newLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ export default function NewLayout({ children }: any) {

async function getQueues() {
const res = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/api/v1/email-queues/all`
`${process.env.NEXT_PUBLIC_API_URL}/api/v1/email-queues/all`,
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${getCookie("session")}`,
},
}
).then((res) => res.json());
setQueues(res.queues);
}
Expand Down
13 changes: 7 additions & 6 deletions apps/client/pages/admin/webhooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async function getHooks(token) {
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
Authorization: `Bearer ${getCookie("session")}`,
},
}
);
Expand All @@ -29,17 +29,14 @@ export default function Notifications() {
const [secret, setSecret] = useState();
const [name, setName] = useState("");

const cookie = getCookie("session");

const { data, status, error, refetch } = useQuery("gethooks", () =>
getHooks(cookie)
);
const { data, status, error, refetch } = useQuery("gethooks", getHooks());

async function addHook() {
await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/webhook/create`, {
method: "post",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${getCookie("session")}`,
},
body: JSON.stringify({
name,
Expand All @@ -60,6 +57,10 @@ export default function Notifications() {
`${process.env.NEXT_PUBLIC_API_URL}/api/v1/admin/webhook/${id}/delete`,
{
method: "DELETE",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${getCookie("session")}`,
},
}
)
.then((res) => res.json())
Expand Down

0 comments on commit 3f480c8

Please sign in to comment.