Skip to content

Commit

Permalink
Fix bugs with Action Cable
Browse files Browse the repository at this point in the history
  • Loading branch information
RISCfuture committed Sep 3, 2024
1 parent 0e4c548 commit 7b1affb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/config/secrets/secrets.development.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Secrets } from '@/config/secrets/type'
const secrets: Secrets = {
bugsnagAPIKey: 'disabled',
APIURL: '',
actionCableURL: 'http://localhost:28080/cable'
actionCableURL: 'ws://localhost:28080/cable'
}
export default secrets
2 changes: 1 addition & 1 deletion src/config/secrets/secrets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Secrets } from '@/config/secrets/type'
const secrets: Secrets = {
bugsnagAPIKey: 'disabled',
APIURL: 'http://localhost:5100',
actionCableURL: 'http://localhost:28080/cable'
actionCableURL: 'ws://localhost:28080/cable'
}
export default secrets
6 changes: 2 additions & 4 deletions src/store/modules/logfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ import {
import { logfileFromJSON, LogfileJSON } from '@/store/coding'
import { loadResponseBodyOrReturnErrors, loadResponseBodyOrThrowError } from '@/store/utils'

let logfilesSubscription: Subscription
let logfilesSubscription: Subscription<Consumer>

function createLogfilesSubscription(consumer: Consumer, dispatch: Dispatch) {
if (logfilesSubscription) logfilesSubscription.unsubscribe()
logfilesSubscription = consumer.subscriptions.create({
channel: 'LogfilesChannel'
}, {
logfilesSubscription = consumer.subscriptions.create('LogfilesChannel', {
received(logfileJSON: string) {
dispatch('logfilesSubscriptionMessage', { logfileJSON: JSON.parse(logfileJSON) })
}
Expand Down
6 changes: 2 additions & 4 deletions src/store/modules/passes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ import {
loadResponseBodyOrThrowError
} from '@/store/utils'

let passesSubscription: Subscription | null = null
let passesSubscription: Subscription<Consumer>

function createPassesSubscription(consumer: Consumer, dispatch: Dispatch) {
if (passesSubscription) passesSubscription.unsubscribe()
passesSubscription = consumer.subscriptions.create({
channel: 'PassesChannel'
}, {
passesSubscription = consumer.subscriptions.create('PassesChannel', {
received(passJSON: string) {
dispatch('passesSubscriptionMessage', { passJSON: JSON.parse(passJSON) })
}
Expand Down

0 comments on commit 7b1affb

Please sign in to comment.