This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// those 2 abstract of the same library are supposed to do the exact same thing, but are written totally differently | |
// because no one cared about restricting the way you should use their public API. | |
// because there's no real public API, because JS. | |
const hasSubscriptionOperation = ({ query: { definitions } }) => { | |
return definitions.some( | |
({ kind, operation }) => | |
kind === 'OperationDefinition' && operation === 'subscription' | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gql from 'graphql-tag' | |
const mutation = gql` | |
mutation CreateGuest { | |
createGuest { | |
token | |
} | |
} | |
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash' | |
import createGuest from '@/graphql/mutations/createGuest' | |
import EventsService from '@/services/EventsService' | |
export default vm => { | |
const events = new EventsService(vm) | |
const perform = async () => { | |
if (getToken() == null) await connectGuest() | |
return getToken() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import getTokenOperation from '@/operations/getTokenOperation' | |
import EventsService from '@/services/EventsService' | |
import PageHelper from '@/helpers/PageHelper' | |
import { currentIdentity } from '@/graphql/queries/currentIdentity' | |
export default { | |
data () { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import EventBus from '@/misc/EventBus' | |
import PageHelper from '@/helpers/PageHelper' | |
class EventsService { | |
constructor(vm) { | |
this.vm = vm | |
} | |
/** | |
* All the event bus related things |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import EventBus from '@/misc/EventBus' | |
import PageHelper from '@/helpers/PageHelper' | |
const EventsFactory = vm => ({ | |
setup() { | |
setupRebootEvent(vm) | |
setupCrashEvent(vm) | |
setupErrorEvent(vm) | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash' | |
import createGuest from '@/graphql/mutations/createGuest' | |
import EventsService from './EventsService' | |
export default vm => ({ | |
identityToken: vm.identityToken, | |
events() { | |
return new EventsService(vm) | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash' | |
import createGuest from '@/graphql/mutations/createGuest' | |
import EventsService from './EventsService' | |
class ConnectService { | |
constructor(vm, identityToken) { | |
this.vm = vm | |
this.identityToken = identityToken | |
this.events = new EventsService(vm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash' | |
import createGuest from '@/graphql/mutations/createGuest' | |
import EventsService from './EventsService' | |
class ConnectService { | |
constructor(vm, identityToken) { | |
this.vm = vm | |
this.identityToken = identityToken | |
this.events = new EventsService(vm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash' | |
import createGuest from '@/graphql/mutations/createGuest' | |
import EventsService from './EventsService' | |
class ConnectService { | |
constructor(vm, identityToken) { | |
this.vm = vm | |
this.identityToken = identityToken | |
this.events = new EventsService(vm) |