Isaac McFadyen | YYZ01
04/09/2022, 4:32 PMHazard
04/09/2022, 4:32 PMIsaac McFadyen | YYZ01
04/09/2022, 4:32 PMHazard
04/09/2022, 5:04 PMts
// IF DEV ENV
if (!process.env["CF_PAGES"] && !userid && email == "admin@a") {
userid = crypto.randomUUID();
let user: User = {
password,
createdAt: new Date().toISOString()
}
await userEmailKV.put(userid, email);
await usersKV.put(userid, JSON.stringify(user));
}
Hazard
04/09/2022, 5:05 PMIsaac McFadyen | YYZ01
04/09/2022, 5:07 PMfalse
.
- Then add one under Preview with a value of true
- Then, in your code, you can check the variable called DEVELOPMENT at runtime.Hazard
04/09/2022, 5:09 PMHazard
04/09/2022, 5:09 PMIsaac McFadyen | YYZ01
04/09/2022, 5:12 PMIsaac McFadyen | YYZ01
04/09/2022, 5:12 PMHazard
04/09/2022, 5:26 PMIsaac McFadyen | YYZ01
04/09/2022, 5:27 PMIsaac McFadyen | YYZ01
04/09/2022, 5:27 PMHazard
04/09/2022, 5:28 PMnpx wrangler pages dev ./svelte-kit -k users
Isaac McFadyen | YYZ01
04/09/2022, 5:29 PM--binding VARIABLE=value
Hazard
04/09/2022, 5:29 PMIsaac McFadyen | YYZ01
04/09/2022, 5:29 PMHazard
04/09/2022, 7:49 PMts
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET,HEAD,POST,OPTIONS,PUT,PATCH,DELETE',
'Access-Control-Max-Age': '86400',
mike.pete
04/09/2022, 8:05 PMIsaac McFadyen | YYZ01
04/09/2022, 9:00 PMHazard
04/09/2022, 9:01 PMAccess to fetch at 'http://localhost:8788/api/v1/login' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Isaac McFadyen | YYZ01
04/09/2022, 9:02 PMcurl -v https://YOUR_URL
with your URL and see what it gives you?Hazard
04/09/2022, 9:07 PMHazard
04/09/2022, 9:07 PMIsaac McFadyen | YYZ01
04/09/2022, 9:07 PMIsaac McFadyen | YYZ01
04/09/2022, 9:07 PMIsaac McFadyen | YYZ01
04/09/2022, 9:07 PMHazard
04/09/2022, 9:08 PMHazard
04/09/2022, 9:09 PMhttps://i.imgur.com/pbDp8Eu.png▾
Hazard
04/09/2022, 9:09 PM