Re-jig config accessors
We only ever used the static instance() method to get to the config object, so just make a static instance that returns the ConfigOptions directly, throwing an exception if it's not yet initialised. This way the types can all be non-optional (plus it's shorter).
This commit is contained in:
@@ -53,7 +53,7 @@ export function useSubmitRageshake(): {
|
||||
|
||||
const submitRageshake = useCallback(
|
||||
async (opts) => {
|
||||
if (!Config.instance.config.rageshake?.submit_url) {
|
||||
if (!Config.get().rageshake?.submit_url) {
|
||||
throw new Error("No rageshake URL is configured");
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ export function useSubmitRageshake(): {
|
||||
);
|
||||
}
|
||||
|
||||
await fetch(Config.instance.config.rageshake?.submit_url, {
|
||||
await fetch(Config.get().rageshake?.submit_url, {
|
||||
method: "POST",
|
||||
body,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user