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:
parent
6303b357ab
commit
c879090a34
4 changed files with 19 additions and 20 deletions
|
|
@ -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,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue