Skip to content

Commit

Permalink
chore: remove getServerSideProps (#2130)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaryan610 authored Sep 11, 2023
1 parent 5b228bd commit 8de93d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 49 deletions.
15 changes: 4 additions & 11 deletions space/pages/[workspace_slug]/[project_slug]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import useSWR from "swr";
import type { GetServerSideProps } from "next";
import { useRouter } from "next/router";
import Head from "next/head";
import { useRouter } from "next/router";

import useSWR from "swr";

/// layouts
import ProjectLayout from "layouts/project-layout";
// components
Expand Down Expand Up @@ -39,12 +40,4 @@ const WorkspaceProjectPage = (props: any) => {
);
};

// export const getServerSideProps: GetServerSideProps<any> = async ({ query: { workspace_slug, project_slug } }) => {
// const res = await fetch(
// `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/public/workspaces/${workspace_slug}/project-boards/${project_slug}/settings/`
// );
// const project_settings = await res.json();
// return { props: { project_settings } };
// };

export default WorkspaceProjectPage;
53 changes: 15 additions & 38 deletions web/pages/installations/[provider]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,20 @@
import React, { useEffect } from "react";

// services
import appinstallationsService from "services/app-installations.service";

import useToast from "hooks/use-toast";

// components
import { Spinner } from "components/ui";

import { useRouter } from "next/router";

interface IGithuPostInstallationProps {
installation_id: string;
setup_action: string;
state: string;
provider: string;
code: string;
}
// services
import appInstallationsService from "services/app-installations.service";
// ui
import { Spinner } from "components/ui";

// TODO:Change getServerSideProps to router.query
const AppPostInstallation = ({
installation_id,
setup_action,
state,
provider,
code,
}: IGithuPostInstallationProps) => {
const { setToastAlert } = useToast();
const AppPostInstallation = () => {
const router = useRouter();
const { installation_id, setup_action, state, provider, code } = router.query;

useEffect(() => {
if (provider === "github" && state && installation_id) {
appinstallationsService
.addInstallationApp(state, provider, { installation_id })
appInstallationsService
.addInstallationApp(state.toString(), provider, { installation_id })
.then(() => {
window.opener = null;
window.open("", "_self");
Expand All @@ -41,10 +24,10 @@ const AppPostInstallation = ({
console.log(err);
});
} else if (provider === "slack" && state && code) {
appinstallationsService
.getSlackAuthDetails(code)
appInstallationsService
.getSlackAuthDetails(code.toString())
.then((res) => {
const [workspaceSlug, projectId, integrationId] = state.split(",");
const [workspaceSlug, projectId, integrationId] = state.toString().split(",");

if (!projectId) {
const payload = {
Expand All @@ -53,8 +36,8 @@ const AppPostInstallation = ({
},
};

appinstallationsService
.addInstallationApp(state, provider, payload)
appInstallationsService
.addInstallationApp(state.toString(), provider, payload)
.then((r) => {
window.opener = null;
window.open("", "_self");
Expand All @@ -73,7 +56,7 @@ const AppPostInstallation = ({
team_name: res.team.name,
scopes: res.scope,
};
appinstallationsService
appInstallationsService
.addSlackChannel(workspaceSlug, projectId, integrationId, payload)
.then((r) => {
window.opener = null;
Expand All @@ -99,10 +82,4 @@ const AppPostInstallation = ({
);
};

export async function getServerSideProps(context: any) {
return {
props: context.query,
};
}

export default AppPostInstallation;

2 comments on commit 8de93d0

@vercel
Copy link

@vercel vercel bot commented on 8de93d0 Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-sh-dev – ./space/

plane-sh-dev-plane.vercel.app
plane-space-dev.vercel.app
plane-sh-dev-git-develop-plane.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 8de93d0 Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./web/

plane-dev-git-develop-plane.vercel.app
plane-dev.vercel.app
plane-dev-plane.vercel.app

Please sign in to comment.