fix: make auth in global variable optional

This commit is contained in:
Ali BARIN
2022-10-08 10:32:34 +02:00
parent 8e972fd875
commit 577abde2e9

View File

@@ -15,16 +15,18 @@ const globalVariable = async (
return { return {
auth: { auth: {
set: async (args: IJSONObject) => { set: async (args: IJSONObject) => {
await connection.$query().patchAndFetch({ if (connection) {
formattedData: { await connection.$query().patchAndFetch({
...connection.formattedData, formattedData: {
...args, ...connection.formattedData,
}, ...args,
}); },
});
}
return null; return null;
}, },
data: connection.formattedData, data: connection?.formattedData,
}, },
app: appData, app: appData,
http: createHttpClient({ baseURL: appData.baseUrl }), http: createHttpClient({ baseURL: appData.baseUrl }),