fix: bug and auth fixes (#1224)

* fix: sign in and invitation page fixes

* fix: project and workspace services track event fix

* fix: user onboarding complete track event fix

* fix: issue track event fix

* fix: partial property , issue comment and mark as done issue track event fix

* fix: bulk delete , move to cycle or module and issue label track event fix

* fix: state , cycle and module track event fix

* fix: pages and block track event fix

* fix: integration , estimate , importer , analytics and gpt track event fix

* fix: view track event fix

* fix: build fix

* fix: build fix
This commit is contained in:
Anmol Singh Bhatia 2023-06-06 21:36:00 +05:30 committed by GitHub
parent c127353281
commit 6f2a38ad66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
117 changed files with 1319 additions and 494 deletions

View file

@ -10,28 +10,12 @@ const jitsu = createClient({
});
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { eventName, extra } = req.body;
const { eventName, user, extra } = req.body;
if (!eventName) {
return res.status(400).json({ message: "Bad request" });
}
const cookie = convertCookieStringToObject(req.headers.cookie);
const accessToken = cookie?.accessToken;
if (!accessToken) return res.status(401).json({ message: "Unauthorized" });
const user = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/users/me/`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${accessToken}`,
},
})
.then((res) => res.json())
.then((data) => data.user)
.catch(() => res.status(401).json({ message: "Unauthorized" }));
if (!user) return res.status(401).json({ message: "Unauthorized" });
// TODO: cache user info