more no-hardcoded-paths

This commit is contained in:
Pablo Martin 2025-03-31 16:38:48 +02:00
parent 72594c34c1
commit 14ee0b4127
3 changed files with 11 additions and 3 deletions

View file

@ -4,7 +4,11 @@ const DEFAULT_REDIRECT_DELAY = 3 * 1000; // 3seconds times milliseconds;
const API_ROOT = '/api'
const API_PATHS = {
offer: API_ROOT + '/offer'
offer: API_ROOT + '/offer',
loginNostrChallenge: API_ROOT + '/login/nostr-challenge',
loginNostrVerify: API_ROOT + '/login/nostr-verify',
signupNostrChallenge: API_ROOT + '/signup/nostr-challenge',
signupNostrVerify: API_ROOT + '/signup/nostr-verify'
};
const WEB_PATHS = {

View file

@ -1,7 +1,9 @@
const constants = require('../../constants');
const requestAndRespondSignUpChallenge = async ({ onNostrErrorCallback }) => {
let challengeResponse;
try {
challengeResponse = await fetch('/api/signup/nostr-challenge', {
challengeResponse = await fetch(constants.API_PATHS.signupNostrChallenge, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -39,7 +41,7 @@ const requestAndRespondSignUpChallenge = async ({ onNostrErrorCallback }) => {
let verifyResponse;
try {
verifyResponse = await fetch('/api/signup/nostr-verify', {
verifyResponse = await fetch(constants.API_PATHS.signupNostrVerify, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(signedEvent),

View file

@ -1,3 +1,5 @@
const constants = require('../../constants');
const requestAndRespondLoginChallenge = async ({
onRejectedPubKeyCallback,
onRejectedSignatureCallback,