don't hardcode api and web endpoints
This commit is contained in:
parent
873493f697
commit
72594c34c1
4 changed files with 13 additions and 5 deletions
|
|
@ -2,14 +2,20 @@ const DEFAULT_SESSION_DURATION_SECONDS = 60 * 60 * 24 * 30;
|
||||||
const DEFAULT_NOSTR_CHALLENGE_DURATION_SECONDS = 60 * 60 * 24 * 30;
|
const DEFAULT_NOSTR_CHALLENGE_DURATION_SECONDS = 60 * 60 * 24 * 30;
|
||||||
const DEFAULT_REDIRECT_DELAY = 3 * 1000; // 3seconds times milliseconds;
|
const DEFAULT_REDIRECT_DELAY = 3 * 1000; // 3seconds times milliseconds;
|
||||||
|
|
||||||
|
const API_ROOT = '/api'
|
||||||
const API_PATHS = {
|
const API_PATHS = {
|
||||||
createProfile: '/createProfile',
|
offer: API_ROOT + '/offer'
|
||||||
home: '/home',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const WEB_PATHS = {
|
||||||
|
home: '/home',
|
||||||
|
createProfile: '/createProfile',
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
DEFAULT_SESSION_DURATION_SECONDS,
|
DEFAULT_SESSION_DURATION_SECONDS,
|
||||||
DEFAULT_NOSTR_CHALLENGE_DURATION_SECONDS,
|
DEFAULT_NOSTR_CHALLENGE_DURATION_SECONDS,
|
||||||
API_PATHS,
|
API_PATHS,
|
||||||
|
WEB_PATHS,
|
||||||
DEFAULT_REDIRECT_DELAY,
|
DEFAULT_REDIRECT_DELAY,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const invitesFunction = () => {
|
||||||
if (verifyResponse.ok) {
|
if (verifyResponse.ok) {
|
||||||
signUpSuccessPopup.display();
|
signUpSuccessPopup.display();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = constants.API_PATHS.createProfile;
|
window.location.href = constants.WEB_PATHS.createProfile;
|
||||||
}, constants.DEFAULT_REDIRECT_DELAY);
|
}, constants.DEFAULT_REDIRECT_DELAY);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ const loginFunction = () => {
|
||||||
nostrLoginButton.disable();
|
nostrLoginButton.disable();
|
||||||
successPopup.display();
|
successPopup.display();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = constants.API_PATHS.home;
|
window.location.href = constants.WEB_PATHS.home;
|
||||||
}, constants.DEFAULT_REDIRECT_DELAY);
|
}, constants.DEFAULT_REDIRECT_DELAY);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
|
const constants = require('../../constants');
|
||||||
|
|
||||||
const createOffer = async (offerDetails) => {
|
const createOffer = async (offerDetails) => {
|
||||||
await fetch('/api/offer', {
|
await fetch(constants.API_PATHS.offer, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue