more no-hardcoded-paths
This commit is contained in:
parent
72594c34c1
commit
14ee0b4127
3 changed files with 11 additions and 3 deletions
|
|
@ -4,7 +4,11 @@ const DEFAULT_REDIRECT_DELAY = 3 * 1000; // 3seconds times milliseconds;
|
||||||
|
|
||||||
const API_ROOT = '/api'
|
const API_ROOT = '/api'
|
||||||
const API_PATHS = {
|
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 = {
|
const WEB_PATHS = {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
const constants = require('../../constants');
|
||||||
|
|
||||||
const requestAndRespondSignUpChallenge = async ({ onNostrErrorCallback }) => {
|
const requestAndRespondSignUpChallenge = async ({ onNostrErrorCallback }) => {
|
||||||
let challengeResponse;
|
let challengeResponse;
|
||||||
try {
|
try {
|
||||||
challengeResponse = await fetch('/api/signup/nostr-challenge', {
|
challengeResponse = await fetch(constants.API_PATHS.signupNostrChallenge, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|
@ -39,7 +41,7 @@ const requestAndRespondSignUpChallenge = async ({ onNostrErrorCallback }) => {
|
||||||
|
|
||||||
let verifyResponse;
|
let verifyResponse;
|
||||||
try {
|
try {
|
||||||
verifyResponse = await fetch('/api/signup/nostr-verify', {
|
verifyResponse = await fetch(constants.API_PATHS.signupNostrVerify, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(signedEvent),
|
body: JSON.stringify(signedEvent),
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
const constants = require('../../constants');
|
||||||
|
|
||||||
const requestAndRespondLoginChallenge = async ({
|
const requestAndRespondLoginChallenge = async ({
|
||||||
onRejectedPubKeyCallback,
|
onRejectedPubKeyCallback,
|
||||||
onRejectedSignatureCallback,
|
onRejectedSignatureCallback,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue