Skip to content

Commit

Permalink
Merge pull request #534 from eoscommunity/main
Browse files Browse the repository at this point in the history
EdenOS Release 0.2.13
  • Loading branch information
brandonfancher authored Oct 1, 2021
2 parents 526fcd4 + 4248858 commit f1a9805
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/box/.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ DFUSE_API_NETWORK = "eos.dfuse.eosnation.io"
DFUSE_AUTH_NETWORK = "https://auth.eosnation.io"
DFUSE_FIRST_BLOCK = "183705819"
DFUSE_JSON_TRX_FILE = "dfuse-transactions.json"
DFUSE_INTERVAL = 30
4 changes: 4 additions & 0 deletions packages/box/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export const dfuseConfig = {
authNetwork: process.env.DFUSE_AUTH_NETWORK || "https://auth.eosnation.io",
firstBlock: +(process.env.DFUSE_FIRST_BLOCK as any) || 1,
jsonTrxFile: process.env.DFUSE_JSON_TRX_FILE || "dfuse-transactions.json",
interval:
"DFUSE_INTERVAL" in process.env
? +(process.env.DFUSE_INTERVAL as any)
: 30,
preventConnect: "DFUSE_PREVENT_CONNECT" in process.env,
};
console.info({ ...dfuseConfig, apiKey: "<secret>" });
Expand Down
2 changes: 1 addition & 1 deletion packages/box/src/dfuse-receiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default class DfuseReceiver {
low: dfuseConfig.firstBlock,
limit: 0,
irrev: false,
interval: 30,
interval: dfuseConfig.interval,
};

dfuseClient = createDfuseClient({
Expand Down
8 changes: 2 additions & 6 deletions packages/webapp/src/_api/zoom-commons.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setCookie, destroyCookie } from "nookies";
import { setCookie } from "nookies";

import { zoom } from "config";

Expand Down Expand Up @@ -114,10 +114,6 @@ export const setZoomJWTCookie = (zoomAccountJWT: any, res: any) => {
);
} else {
console.info("destroying cookie");
destroyCookie({ res }, "zoomAccountJWT", {
httpOnly: true,
path: "/api",
secure: true,
});
res.setHeader("Set-Cookie", "zoomAccountJWT=; Path=/api; Max-Age=-1;");
}
};
9 changes: 8 additions & 1 deletion packages/webapp/src/_app/hooks/signout.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { useQueryClient } from "react-query";
import { v4 as uuidv4 } from "uuid";

import { useUALAccount, useZoomLinkedAccount } from "_app";

export const useSignOut = () => {
Expand All @@ -11,7 +13,12 @@ export const useSignOut = () => {
const signOut = async () => {
queryClient.clear();
try {
await fetch("/api/signout");
await fetch("/api/signout", {
method: "POST",
body: JSON.stringify({
signoutUuid: uuidv4(),
}),
});
} catch (error) {
console.error("error clearing cookies signing out", error as Error);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/webapp/src/pages/api/signout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { setZoomJWTCookie } from "_api/zoom-commons";

export default async (req: NextApiRequest, res: NextApiResponse) => {
switch (req.method) {
case "GET":
case "POST":
return handleSignOut(req, res);
default:
return handleErrors(
Expand All @@ -15,10 +15,10 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
}
};

const handleSignOut = async (req: NextApiRequest, res: NextApiResponse) => {
const handleSignOut = async (_req: NextApiRequest, res: NextApiResponse) => {
try {
setZoomJWTCookie(null, res); // clear zoom JWT cookie
res.send("success");
res.status(200).json({ success: "ok" });
} catch (error) {
console.error(error);
return handleErrors(res, error as Error);
Expand Down

0 comments on commit f1a9805

Please sign in to comment.