Skip to content

Commit

Permalink
feat: redirect user to workspaces after onboarding (open-sauced#3621)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts authored Jun 24, 2024
1 parent 8141092 commit 0e686dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion img/icons/interests/swift.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 8 additions & 7 deletions pages/start.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ const LoginStep1: React.FC<LoginStep1Props> = ({ user }) => {

useEffect(() => {
if (onboarded) {
router.push(`/u/${user?.user_metadata.user_name}`);
router.push("/workspaces");
} else if (onboarded === false && user && providerToken) {
setQueryParams({ step: "2" } satisfies QueryParams);
}
}, [user, onboarded, providerToken]);

const handleGitHubAuth = async () => {
// Redirect user to GitHub to authenticate
await signIn({ provider: "github" });
await signIn({
provider: "github",
options: { redirectTo: `${window.location.origin}/start?step=2` },
});
};

return (
Expand Down Expand Up @@ -244,7 +247,7 @@ const LoginStep3: React.FC<LoginStep3Props> = ({ interests, user }) => {

if (data.ok) {
store.onboardUser();
router.push(`/u/${user?.user_metadata.user_name}`);
router.push("/workspaces");
} else {
setLoading(false);
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -328,9 +331,7 @@ const Login: WithPageLayout = () => {
const [interests, setInterests] = useState<string[]>([]);

useEffect(() => {
if (!step) {
setQueryParams({ step: "1" } satisfies QueryParams);
} else {
if (step) {
setCurrentLoginStep(Number(step));
}
}, [step]);
Expand All @@ -343,7 +344,7 @@ const Login: WithPageLayout = () => {
<ProgressPie
percentage={currentLoginStep === 1 ? 0 : currentLoginStep === 2 ? 33 : currentLoginStep === 3 ? 66 : 100}
/>
<Title className="!text-2xl">Lets get started</Title>
<Title className="!text-2xl">Let&apos;s get started</Title>
</div>
<div className="mb-8">
<Text className="!text-sm">
Expand Down

0 comments on commit 0e686dd

Please sign in to comment.