p4j4r5
p4j4r5
WWasp
Created by p4j4r5 on 3/1/2025 in #đŸ™‹questions
Redirect to user to same page after login
Thank @genyus I will refactor the code to use react-router-dom method
18 replies
WWasp
Created by p4j4r5 on 3/1/2025 in #đŸ™‹questions
Redirect to user to same page after login
And this page is now hooked up in main.wasp as below onAuthSucceededRedirectTo: "/user/onboarding",
18 replies
WWasp
Created by p4j4r5 on 3/1/2025 in #đŸ™‹questions
Redirect to user to same page after login
Managed to solve this by creating a new page named userOnboarding which checks for redirect url in localstorage and navigates user appropriately. const UserOnBoardingPage: React.FC<UserOnBoardingPageProps> = ({ user }) => { const redirectUrl = localStorage.getItem('redirectUrl'); React.useEffect(() => { if (redirectUrl) { window.location.href = redirectUrl; } else { window.location.href = '/user/home'; } }, [redirectUrl]); return ( <DefaultLayout user={user}> <div className='flex flex-col gap-10'> <div className="text-center text-gray-500 py-10">Redirecting...</div> </div> </DefaultLayout> ); }; export default UserOnBoardingPage;
18 replies
WWasp
Created by p4j4r5 on 3/1/2025 in #đŸ™‹questions
Redirect to user to same page after login
This means I need to create custom loginPage and not be able to use LoginForm react component that comes with OpenSaas
18 replies
WWasp
Created by p4j4r5 on 3/1/2025 in #đŸ™‹questions
Redirect to user to same page after login
@kapa.ai Explain me how can I use 'onAuthSuceeded' to direct user to url that is stored in localstorage
18 replies
WWasp
Created by p4j4r5 on 3/1/2025 in #đŸ™‹questions
Redirect to user to same page after login
onAuthSucceededRedirectTo is static defintion in main.wasp file. The url they are on , isn't aware until they click login from that URL. These Url's are different urls that they find in social websites
18 replies
WWasp
Created by p4j4r5 on 1/29/2025 in #đŸ™‹questions
SEO issue . Twitter or facebook cannot recognise meta tags
Right so it is same issue I am facing.. I want to add meta tags for each of the page and different to what is in main.wasp
25 replies
WWasp
Created by p4j4r5 on 1/29/2025 in #đŸ™‹questions
SEO issue . Twitter or facebook cannot recognise meta tags
I have the data in markdown which I would want to display as pages. This issue of not able to have proper meta tags, is holding me back on SEO optimisation. On a different option, can have another server say in next JS, be able to use the authentication. Idea is to have page rendered via nextjs, but one of the API ( which gives full content) be visible only if authenticated.
25 replies
WWasp
Created by p4j4r5 on 1/29/2025 in #đŸ™‹questions
SEO issue . Twitter or facebook cannot recognise meta tags
So it seems I need to rely on server side rendering.
25 replies
WWasp
Created by p4j4r5 on 1/29/2025 in #đŸ™‹questions
SEO issue . Twitter or facebook cannot recognise meta tags
No description
25 replies
WWasp
Created by p4j4r5 on 1/29/2025 in #đŸ™‹questions
SEO issue . Twitter or facebook cannot recognise meta tags
Hi I am using Open Saas Template and using helmet to add custom content tags
25 replies
WWasp
Created by p4j4r5 on 1/29/2025 in #đŸ™‹questions
SEO issue . Twitter or facebook cannot recognise meta tags
I need this page rendered from the server data I have and blog solution isn't feasible. I am using react-helmet-async
25 replies
WWasp
Created by p4j4r5 on 11/16/2024 in #đŸ™‹questions
sendgrid use email templates
Alright then. I may need to stick to defining templates within App, which isn't efficient for maintenance and wish I could use templates that are already defined.
6 replies
WWasp
Created by balina on 7/18/2024 in #đŸ™‹questions
Is there a way automatically navigate to another page
Is this in new version v0.15 ? I am on version 0.14. May need to update it to 0.15 first then
16 replies
WWasp
Created by balina on 7/18/2024 in #đŸ™‹questions
Is there a way automatically navigate to another page
@martinsos
I have hit the same issue ,where I have page which is rendered partial if user isn't signed up or logged in. Once he signs up, I need to redirect the user back to that page. So wondering if any options are there for this?
16 replies
WWasp
Created by p4j4r5 on 11/7/2024 in #đŸ™‹questions
How to use authUser conditionally in a react page?
This is how I do
import { getFullDetails, getMeteredDetails } from 'wasp/client/operations';
import { getFullDetails, getMeteredDetails } from 'wasp/client/operations';
const { data: user } = useAuth()
const [metered, setMetered] = React.useState<boolean>(false);
React.useEffect(() => {
// Replace with your data fetching logic
const fetchData = async () => {
try {
if (user) {
const response = await getFullDetails({ id });
setMetered(false);

} else {
const response = await getMeteredDetails({ id });
setMetered(true);
}

} catch (error) {
console.error( error);
}
}
fetchData();
}, [match.params.id, user]);
const { data: user } = useAuth()
const [metered, setMetered] = React.useState<boolean>(false);
React.useEffect(() => {
// Replace with your data fetching logic
const fetchData = async () => {
try {
if (user) {
const response = await getFullDetails({ id });
setMetered(false);

} else {
const response = await getMeteredDetails({ id });
setMetered(true);
}

} catch (error) {
console.error( error);
}
}
fetchData();
}, [match.params.id, user]);
in JSX I display data based on the state of metered variable
{metered && (<div> metered content </div> )
{metered && (<div> metered content </div> )
19 replies
WWasp
Created by p4j4r5 on 11/8/2024 in #đŸ™‹questions
How to add delay to all responses
Nice.. that works.
11 replies
WWasp
Created by p4j4r5 on 11/8/2024 in #đŸ™‹questions
How to add delay to all responses
@kapa.ai I tried adding below code and the server doesn't delay the responses . Any idea why?
//File @src/serverSetup.ts
import { config, ServerSetupFn, type MiddlewareConfigFn } from 'wasp/server'
import delay from 'express-delay'
export const slowDownResponses: ServerSetupFn = async ({ app }) => {
console.log('Setting up slow down responses middleware')
app.use(delay(2000));
}
//File @src/serverSetup.ts
import { config, ServerSetupFn, type MiddlewareConfigFn } from 'wasp/server'
import delay from 'express-delay'
export const slowDownResponses: ServerSetupFn = async ({ app }) => {
console.log('Setting up slow down responses middleware')
app.use(delay(2000));
}
// Main.wasp

wasp: {
version: "^0.14.0"
},
server: {
setupFn: import { slowDownResponses } from "@src/serverSetup",
},
// Main.wasp

wasp: {
version: "^0.14.0"
},
server: {
setupFn: import { slowDownResponses } from "@src/serverSetup",
},
11 replies
WWasp
Created by p4j4r5 on 11/7/2024 in #đŸ™‹questions
How to use authUser conditionally in a react page?
I use useAuth() hook like this const { data: user } = useAuth() And then in useEffect, I conditionally call two different endpoints based on user variable and the authRequired on PageRoute within main.wasp is set to false
19 replies
WWasp
Created by p4j4r5 on 11/7/2024 in #đŸ™‹questions
How to use authUser conditionally in a react page?
Thanks @Sven Using const { data: user } = useAuth() works well. The suggestion you made seems to fail for me because I don't want authentication and the user object isn't injected into Props. Then typescript check fails.
19 replies