Vylepseni SSR, pridani meta informaci, zatim dost WIP
This commit is contained in:
@@ -17,15 +17,22 @@ export const deleteFromItems = (items, key, value) => {
|
||||
items.splice(idx, 1);
|
||||
}
|
||||
|
||||
export const query = ({isQueryRunning, query, variables}) => {
|
||||
export const query = ({isQueryRunning, query, variables, refreshUnauthorized}) => {
|
||||
if (variables && variables.id) {
|
||||
variables.id = parseInt(variables.id);
|
||||
}
|
||||
|
||||
query._refreshUnauthorizedUser = refreshUnauthorized;
|
||||
|
||||
isQueryRunning.value = true;
|
||||
const queryName = query.definitions[0].selectionSet.selections[0].name.value;
|
||||
return apolloWrapper.query(query, variables)
|
||||
.then((result) => result.data[queryName])
|
||||
.then((result) => {
|
||||
if (!result || result.error || !result.data) {
|
||||
return null;
|
||||
}
|
||||
return result.data[queryName]
|
||||
})
|
||||
.finally(() => isQueryRunning.value = false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user