-
-
Save Harasz/083a6fb5dff9ff53c11dd6ab7365dfb7 to your computer and use it in GitHub Desktop.
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
const getSettings = async () => { | |
setIsLoading(true); | |
try { | |
const token = await getSessionToken(app); | |
const res = await fetch("/settings", { | |
headers: { Authorization: `Bearer ${token}` }, | |
}); | |
const responseData = await res.json(); | |
if (responseData.status === "EMPTY_SETTINGS") { | |
return; | |
} | |
if (responseData.status === "OK_SETTINGS") { | |
setSettingsObj(responseData.data); | |
return; | |
} | |
throw Error("Unknown settings status"); | |
} catch (err) { | |
setError(err.message); | |
} finally { | |
setIsLoading(false); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment