mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-14 12:24:04 +00:00
chore: add env vars for local dev
This commit is contained in:
parent
4975963d9e
commit
0d71e1f613
|
@ -37,6 +37,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-react": "^7.17.12",
|
"@babel/preset-react": "^7.17.12",
|
||||||
"@types/lodash": "^4.14.182",
|
"@types/lodash": "^4.14.182",
|
||||||
|
"@types/node": "^17.0.36",
|
||||||
"@types/prismjs": "^1.26.0",
|
"@types/prismjs": "^1.26.0",
|
||||||
"@types/react": "^18.0.9",
|
"@types/react": "^18.0.9",
|
||||||
"@types/react-dom": "^18.0.5",
|
"@types/react-dom": "^18.0.5",
|
||||||
|
|
|
@ -15,13 +15,16 @@ export function HomeCTA() {
|
||||||
const [waitlistEmail, setWaitlistEmail] = useState('');
|
const [waitlistEmail, setWaitlistEmail] = useState('');
|
||||||
const [fire, setFire] = useState<boolean | number>(false);
|
const [fire, setFire] = useState<boolean | number>(false);
|
||||||
|
|
||||||
|
const prod = process.env.NODE_ENV === 'production';
|
||||||
|
const url = prod ? 'https://waitlist-api.spacedrive.com' : 'http://localhost:3000';
|
||||||
|
|
||||||
async function handleWaitlistSubmit(e: FormEvent<HTMLFormElement>) {
|
async function handleWaitlistSubmit(e: FormEvent<HTMLFormElement>) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!waitlistEmail.trim().length) return;
|
if (!waitlistEmail.trim().length) return;
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
const req = await fetch('https://waitlist-api.spacedrive.com/api/waitlist', {
|
const req = await fetch(`${url}/api/waitlist`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
|
|
|
@ -50,13 +50,24 @@ function Page() {
|
||||||
if (!cuid) return;
|
if (!cuid) return;
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const req = await fetch(`https://waitlist-api.spacedrive.com/api/waitlist?i=${cuid}`, {
|
const prod = process.env.NODE_ENV === 'production';
|
||||||
|
const url = prod ? 'https://waitlist-api.spacedrive.com' : 'http://localhost:3000';
|
||||||
|
|
||||||
|
const req = await fetch(`${url}/api/waitlist?i=${cuid}`, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (req.status === 200) {
|
if (req.status === 200) {
|
||||||
setUnsubscribedFromWaitlist(true);
|
setUnsubscribedFromWaitlist(true);
|
||||||
window.history.replaceState({}, '', 'https://spacedrive.com/');
|
window.history.replaceState(
|
||||||
|
{},
|
||||||
|
'',
|
||||||
|
prod ? 'https://spacedrive.com' : 'http://localhost:8003'
|
||||||
|
);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
setUnsubscribedFromWaitlist(false);
|
||||||
|
}, 5000);
|
||||||
} else if (req.status >= 400 && req.status < 500) {
|
} else if (req.status >= 400 && req.status < 500) {
|
||||||
alert('An error occurred while unsubscribing from waitlist');
|
alert('An error occurred while unsubscribing from waitlist');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
{
|
{
|
||||||
"extends": "../../packages/config/interface.tsconfig.json",
|
"extends": "../../packages/config/interface.tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
"include": ["src"]
|
"types": [
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ importers:
|
||||||
'@types/compression': ^1.7.2
|
'@types/compression': ^1.7.2
|
||||||
'@types/express': ^4.17.13
|
'@types/express': ^4.17.13
|
||||||
'@types/lodash': ^4.14.182
|
'@types/lodash': ^4.14.182
|
||||||
|
'@types/node': ^17.0.36
|
||||||
'@types/prismjs': ^1.26.0
|
'@types/prismjs': ^1.26.0
|
||||||
'@types/react': ^18.0.9
|
'@types/react': ^18.0.9
|
||||||
'@types/react-dom': ^18.0.5
|
'@types/react-dom': ^18.0.5
|
||||||
|
@ -142,6 +143,7 @@ importers:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@babel/preset-react': 7.17.12
|
'@babel/preset-react': 7.17.12
|
||||||
'@types/lodash': 4.14.182
|
'@types/lodash': 4.14.182
|
||||||
|
'@types/node': 17.0.36
|
||||||
'@types/prismjs': 1.26.0
|
'@types/prismjs': 1.26.0
|
||||||
'@types/react': 18.0.9
|
'@types/react': 18.0.9
|
||||||
'@types/react-dom': 18.0.5
|
'@types/react-dom': 18.0.5
|
||||||
|
@ -152,7 +154,7 @@ importers:
|
||||||
postcss: 8.4.14
|
postcss: 8.4.14
|
||||||
sass: 1.52.1
|
sass: 1.52.1
|
||||||
tailwind: 4.0.0
|
tailwind: 4.0.0
|
||||||
ts-node: 10.8.0_typescript@4.7.2
|
ts-node: 10.8.0_w6gfxie3xfwntbz3mwbbvycbdq
|
||||||
typescript: 4.7.2
|
typescript: 4.7.2
|
||||||
vite: 2.9.9_sass@1.52.1
|
vite: 2.9.9_sass@1.52.1
|
||||||
vite-plugin-markdown: 2.0.2_vite@2.9.9
|
vite-plugin-markdown: 2.0.2_vite@2.9.9
|
||||||
|
@ -16096,36 +16098,6 @@ packages:
|
||||||
tslib: 2.4.0
|
tslib: 2.4.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/ts-node/10.8.0_typescript@4.7.2:
|
|
||||||
resolution: {integrity: sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==}
|
|
||||||
hasBin: true
|
|
||||||
peerDependencies:
|
|
||||||
'@swc/core': '>=1.2.50'
|
|
||||||
'@swc/wasm': '>=1.2.50'
|
|
||||||
'@types/node': '*'
|
|
||||||
typescript: '>=2.7'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
'@swc/core':
|
|
||||||
optional: true
|
|
||||||
'@swc/wasm':
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
'@cspotcode/source-map-support': 0.8.1
|
|
||||||
'@tsconfig/node10': 1.0.8
|
|
||||||
'@tsconfig/node12': 1.0.9
|
|
||||||
'@tsconfig/node14': 1.0.1
|
|
||||||
'@tsconfig/node16': 1.0.2
|
|
||||||
acorn: 8.7.1
|
|
||||||
acorn-walk: 8.2.0
|
|
||||||
arg: 4.1.3
|
|
||||||
create-require: 1.1.1
|
|
||||||
diff: 4.0.2
|
|
||||||
make-error: 1.3.6
|
|
||||||
typescript: 4.7.2
|
|
||||||
v8-compile-cache-lib: 3.0.1
|
|
||||||
yn: 3.1.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/ts-node/10.8.0_w6gfxie3xfwntbz3mwbbvycbdq:
|
/ts-node/10.8.0_w6gfxie3xfwntbz3mwbbvycbdq:
|
||||||
resolution: {integrity: sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==}
|
resolution: {integrity: sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
Loading…
Reference in a new issue