Skip to content

Commit

Permalink
fix: handle the case where no page was teh previous page for login re…
Browse files Browse the repository at this point in the history
…direct
  • Loading branch information
ydennisy committed Apr 21, 2024
1 parent 1179062 commit 5f85e12
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/components/SignUp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const signUp = async (data: { email: string }) => {
};
const login = async (provider: 'github' | 'google' | 'twitter') => {
console.log(`${appBase}/confirm`);
const { error } = await client.auth.signInWithOAuth({
provider,
options: {
Expand Down
1 change: 1 addition & 0 deletions frontend/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default defineNuxtConfig({
runtimeConfig: {
public: {
apiBase: '',
appBase: '',
},
},
routeRules: {
Expand Down
7 changes: 7 additions & 0 deletions frontend/pages/confirm.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<script setup lang="ts">
const redirectToPreviousPath = async () => {
const redirectPath = useCookie('sb-redirect-path');
if (!redirectPath) {
await navigateTo('/');
}
await navigateTo(redirectPath.value);
};
onMounted(async () => {
await redirectToPreviousPath();
});
</script>

<template>
<p>Redirecting...</p>
</template>
6 changes: 3 additions & 3 deletions frontend/pages/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ useHead({ title: 'KG1 - AI powered KMS' });
<div class="container mx-auto text-center">
<h2 class="text-2xl font-semibold">Warning</h2>
<p class="mt-2">
This is a very early prototype, with no accounts or long term
guarantees on persistence of data. <br />
Do not yet rely on KG1 in any way!
This is a very early prototype, with no long term guarantees on
persistence of data. <br />
Do not YET rely on KG1 in any way!
</p>
</div>
</section>
Expand Down

0 comments on commit 5f85e12

Please sign in to comment.