mirror of
https://github.com/anultravioletaurora/Jellify.git
synced 2026-05-13 00:54:02 -05:00
okokokokok
This commit is contained in:
@@ -3,14 +3,16 @@ import { AsyncStorageKeys } from "../../../enums/async-storage-keys"
|
||||
import _ from "lodash";
|
||||
|
||||
|
||||
export const fetchServerUrl : () => Promise<string | null> = async () => {
|
||||
export const fetchServerUrl : () => Promise<string | undefined> = async () => {
|
||||
|
||||
console.log("Attempting to fetch server address from storage");
|
||||
|
||||
let url = await AsyncStorage.getItem(AsyncStorageKeys.ServerUrl)!;
|
||||
|
||||
if (_.isNull(url))
|
||||
Promise.reject("Stored server address was null");
|
||||
if (_.isEmpty(url)) {
|
||||
Promise.reject("No stored server address exists");
|
||||
return;
|
||||
}
|
||||
|
||||
return url;
|
||||
return url!;
|
||||
}
|
||||
@@ -10,11 +10,11 @@ export const useCredentials = useQuery({
|
||||
|
||||
let serverUrl = await fetchServerUrl();
|
||||
|
||||
if (_.isNull(serverUrl)) {
|
||||
if (_.isEmpty(serverUrl)) {
|
||||
Promise.reject("Can't fetch credentials if server address doesn't exist yet :|");
|
||||
return;
|
||||
}
|
||||
|
||||
return await fetchCredentials(serverUrl);
|
||||
return await fetchCredentials(serverUrl!);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user