mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: next_path enabled for oauth auth (#4526)
This commit is contained in:
parent
836452f074
commit
1355873e32
@ -1,4 +1,5 @@
|
|||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
// helpers
|
// helpers
|
||||||
@ -12,12 +13,14 @@ export type GithubOAuthButtonProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const GithubOAuthButton: FC<GithubOAuthButtonProps> = (props) => {
|
export const GithubOAuthButton: FC<GithubOAuthButtonProps> = (props) => {
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const nextPath = searchParams.get("next_path") || undefined;
|
||||||
const { text } = props;
|
const { text } = props;
|
||||||
// hooks
|
// hooks
|
||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
|
|
||||||
const handleSignIn = () => {
|
const handleSignIn = () => {
|
||||||
window.location.assign(`${API_BASE_URL}/auth/spaces/github/`);
|
window.location.assign(`${API_BASE_URL}/auth/spaces/github/${nextPath ? `?next_path=${nextPath}` : ``}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
// helpers
|
// helpers
|
||||||
@ -11,12 +12,14 @@ export type GoogleOAuthButtonProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const GoogleOAuthButton: FC<GoogleOAuthButtonProps> = (props) => {
|
export const GoogleOAuthButton: FC<GoogleOAuthButtonProps> = (props) => {
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const nextPath = searchParams.get("next_path") || undefined;
|
||||||
const { text } = props;
|
const { text } = props;
|
||||||
// hooks
|
// hooks
|
||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
|
|
||||||
const handleSignIn = () => {
|
const handleSignIn = () => {
|
||||||
window.location.assign(`${API_BASE_URL}/auth/spaces/google/`);
|
window.location.assign(`${API_BASE_URL}/auth/spaces/google/${nextPath ? `?next_path=${nextPath}` : ``}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
// helpers
|
// helpers
|
||||||
@ -12,12 +13,14 @@ export type GithubOAuthButtonProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const GithubOAuthButton: FC<GithubOAuthButtonProps> = (props) => {
|
export const GithubOAuthButton: FC<GithubOAuthButtonProps> = (props) => {
|
||||||
|
const { query } = useRouter();
|
||||||
|
const { next_path } = query;
|
||||||
const { text } = props;
|
const { text } = props;
|
||||||
// hooks
|
// hooks
|
||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
|
|
||||||
const handleSignIn = () => {
|
const handleSignIn = () => {
|
||||||
window.location.assign(`${API_BASE_URL}/auth/github/`);
|
window.location.assign(`${API_BASE_URL}/auth/github/${next_path ? `?next_path=${next_path}` : ``}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
// helpers
|
// helpers
|
||||||
@ -11,12 +12,14 @@ export type GoogleOAuthButtonProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const GoogleOAuthButton: FC<GoogleOAuthButtonProps> = (props) => {
|
export const GoogleOAuthButton: FC<GoogleOAuthButtonProps> = (props) => {
|
||||||
|
const { query } = useRouter();
|
||||||
|
const { next_path } = query;
|
||||||
const { text } = props;
|
const { text } = props;
|
||||||
// hooks
|
// hooks
|
||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
|
|
||||||
const handleSignIn = () => {
|
const handleSignIn = () => {
|
||||||
window.location.assign(`${API_BASE_URL}/auth/google/`);
|
window.location.assign(`${API_BASE_URL}/auth/google/${next_path ? `?next_path=${next_path}` : ``}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user