1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 19:34:34 +00:00

fix: cors enabled for desktop mode

This commit is contained in:
Saad Jutt
2021-11-13 23:29:27 +05:00
parent cbe07b4abb
commit 2bb10c7166
6 changed files with 47 additions and 28 deletions

View File

@@ -7,16 +7,17 @@ const headers = {
Accept: 'application/json',
'Content-Type': 'application/json'
}
const baseUrl =
process.env.NODE_ENV === 'development' ? 'http://localhost:5000' : undefined
const getAuthCode = async (credentials: any) => {
return fetch('/SASjsApi/auth/authorize', {
return fetch(`${baseUrl}/SASjsApi/auth/authorize`, {
method: 'POST',
headers,
body: JSON.stringify(credentials)
}).then((data) => data.json())
}
const getTokens = async (payload: any) => {
return fetch('/SASjsApi/auth/token', {
return fetch(`${baseUrl}/SASjsApi/auth/token`, {
method: 'POST',
headers,
body: JSON.stringify(payload)