nitro-web 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -549,7 +549,7 @@ export async function tokenSend({ type = 'reset', _id, email, firstName, beforeU
|
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
function getBaseUrl(req) {
|
|
552
|
-
return resolveBaseUrl(req?.
|
|
552
|
+
return resolveBaseUrl(req?.nitroBaseUrl, authConfig.baseUrl)
|
|
553
553
|
}
|
|
554
554
|
|
|
555
555
|
export function resolveBaseUrl(reqUrl, cfgUrl) {
|
|
@@ -6,9 +6,10 @@ type signinProps = {
|
|
|
6
6
|
className?: string,
|
|
7
7
|
elements?: { Button?: typeof Button, Header?: React.ReactNode },
|
|
8
8
|
redirectTo?: string,
|
|
9
|
+
hideSignup?: boolean,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export function Signin({ className, elements, redirectTo }: signinProps) {
|
|
12
|
+
export function Signin({ className, elements, redirectTo, hideSignup }: signinProps) {
|
|
12
13
|
const navigate = useNavigate()
|
|
13
14
|
const location = useLocation()
|
|
14
15
|
const isSignout = location.pathname == '/signout'
|
|
@@ -79,7 +80,9 @@ export function Signin({ className, elements, redirectTo }: signinProps) {
|
|
|
79
80
|
</div>
|
|
80
81
|
|
|
81
82
|
<div class="mb-14">
|
|
82
|
-
|
|
83
|
+
{!hideSignup && (
|
|
84
|
+
<Fragment>Don't have an account? You can <Link to="/signup" class="underline2 is-active">sign up here</Link>.</Fragment>
|
|
85
|
+
)}
|
|
83
86
|
<FormError state={state} className="pt-2" />
|
|
84
87
|
</div>
|
|
85
88
|
|
|
@@ -82,7 +82,7 @@ async function billingPortalSessionCreate(req, res) {
|
|
|
82
82
|
}
|
|
83
83
|
const session = await stripe.billingPortal.sessions.create({
|
|
84
84
|
customer: req.user.stripeCustomer.id,
|
|
85
|
-
return_url: resolveBaseUrl(req.
|
|
85
|
+
return_url: resolveBaseUrl(req.nitroBaseUrl, config.baseUrl) + '/subscriptions',
|
|
86
86
|
})
|
|
87
87
|
res.json(session.url)
|
|
88
88
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
6
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|
package/server/router.js
CHANGED
|
@@ -338,8 +338,8 @@ export const middleware = {
|
|
|
338
338
|
modifyRequest: (req, res, next) => {
|
|
339
339
|
// Handy boolean denoting that the request wants JSON returned
|
|
340
340
|
req.json = req.xhr || req.accepts(['html', 'json']) == 'json'
|
|
341
|
-
// Dynamic baseUrl from the request headers, may require app.set('trust proxy', 1) in the server setup
|
|
342
|
-
req.
|
|
341
|
+
// Dynamic baseUrl from the request headers, may require app.set('trust proxy', 1) in the server setup for heroku proxying
|
|
342
|
+
req.nitroBaseUrl = req.protocol + '://' + req.headers.host
|
|
343
343
|
// log the headers if the config.logHeaders is true
|
|
344
344
|
if (configLocal.logHeaders) {
|
|
345
345
|
console.info('Headers:', req.headers)
|