p4j4r5
p4j4r5
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
WWasp
Created by p4j4r5 on 11/7/2024 in #đŸ™‹questions
How to use authUser conditionally in a react page?
Thanks @kapa.ai Seems this should work for me. Will give this a try
19 replies
WWasp
Created by p4j4r5 on 11/5/2024 in #đŸ™‹questions
How differentiate different status codes on client from HTTPerror thrown
@kapa.ai What is the function to use instead of useQuery when interacting with actions
10 replies
WWasp
Created by p4j4r5 on 10/21/2024 in #đŸ™‹questions
Can I disable cors on backend
` wasp: { version: "^0.14.0" }, server: { middlewareConfigFn: import { serverMiddlewareFn } from "@src/serverSetup" },
11 replies
WWasp
Created by p4j4r5 on 10/21/2024 in #đŸ™‹questions
Can I disable cors on backend
and the main.wasp is as below
11 replies
WWasp
Created by p4j4r5 on 10/21/2024 in #đŸ™‹questions
Can I disable cors on backend
Yeah import looks all good. here is what I have // src/serverSetup.js import cors from 'cors' import { config, type MiddlewareConfigFn } from 'wasp/server' export const serverMiddlewareFn: MiddlewareConfigFn = (middlewareConfig) => { // Example of adding an extra domains to CORS. middlewareConfig.set('cors', cors({ origin: [config.frontendUrl, 'https://youtube.com'] })) return middlewareConfig }
11 replies
WWasp
Created by p4j4r5 on 10/21/2024 in #đŸ™‹questions
Can I disable cors on backend
I am planning to use nginx for compression and other features. Handling cors using middle ware isn't working. I am doing exactly same thing as Bot suggested. Handling COR's on nginx is the other option I am pursuing. However there is no option for server not to setup CORS at all.
11 replies
WWasp
Created by p4j4r5 on 10/21/2024 in #đŸ™‹questions
Can I disable cors on backend
Is the setupFN necessary? In the example above or in my case, I don't export this default setupFn: import setup from "@src/serverSetup",
11 replies
WWasp
Created by p4j4r5 on 10/16/2024 in #đŸ™‹questions
How to build the just web-app
Thanks @martinsos Yeah I am sort of doing that now. I added a custom command which runs both wasp build and npm run build in .wasp/build/web-app directory. Cloudflare pages doesn't seem to allow option to push the files, so had to do this way
11 replies
WWasp
Created by p4j4r5 on 10/16/2024 in #đŸ™‹questions
How to build the just web-app
Directory .wasp/build/web-app won't exist unless I run wasp build
11 replies
WWasp
Created by p4j4r5 on 10/14/2024 in #đŸ™‹questions
How to install paritcular version of wasp
Thanks a lot. That helps
6 replies
WWasp
Created by atomic-peter on 10/11/2024 in #đŸ™‹questions
Add credits to each subscription
I m working on something similar Monthly subscription - Max 100 A items and total 100 items B Credit purchase - if user on free plan, Max A items changes to 50 ( with expiry of 2 months) and total 50 items B - If a monthly subscriber purchases credit purchase because he ran out of B, then Max A still remain at 100, while B increase it by 50. Seems this is possible , by tweaking plan effect and passing those to be updated by the method updateUserStripePaymentDetails in webhook.ts
11 replies
WWasp
Created by p4j4r5 on 10/10/2024 in #đŸ™‹questions
How to create a credit plan where I want to provide credits to multiple user features
Having different plan for different feature isn't desirable. As User have to pay many times to get to use features.
11 replies