-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move code with private env to different file (#521)
* fix: add BACKEND_URL arg to avoid build error * fix: add BACKEND_URL arg to avoid build error * refactor: move code with private env to different file
- Loading branch information
1 parent
ffad7e3
commit a02ab94
Showing
6 changed files
with
43 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { BACKEND_URL } from '$env/static/private'; | ||
|
||
// TODO: Add toCheck | ||
export async function setSettings(fetch: any, toSet: any) { | ||
const settings = await fetch(`${BACKEND_URL}/settings/set`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify(toSet) | ||
}); | ||
const settingsData = await settings.json(); | ||
|
||
return { | ||
data: settingsData | ||
}; | ||
} | ||
|
||
export async function saveSettings(fetch: any) { | ||
const data = await fetch(`${BACKEND_URL}/settings/save`, { | ||
method: 'POST' | ||
}); | ||
const response = await data.json(); | ||
|
||
return { | ||
data: response | ||
}; | ||
} | ||
|
||
export async function loadSettings(fetch: any) { | ||
const data = await fetch(`${BACKEND_URL}/settings/load`, { | ||
method: 'GET' | ||
}); | ||
const response = await data.json(); | ||
|
||
return { | ||
data: response | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters