Skip to content

Commit

Permalink
fix: Don't connect when there is no token (#30)
Browse files Browse the repository at this point in the history
* fix: Don't connect when there is no token

* fix: Don't connect when there is no token
  • Loading branch information
ryanwi authored Jan 24, 2024
1 parent c5babf4 commit d976200
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions public/full.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ function restoreUI() {
}

async function getClient() {
if (!client) {
if (!client && _token) {
client = await SWire({
host: _host,
token: _token,
Expand All @@ -365,6 +365,8 @@ async function getClient() {
* Connect with Relay creating a client and attaching all the event handler.
*/
window.connect = async () => {
if (!_token) return

const client = await getClient()
window.__client = client

Expand Down Expand Up @@ -854,7 +856,9 @@ window.seekForwardPlayback = () => {
window.ready(async function () {
console.log('Ready!')
const client = await getClient()
await client.connect()
if (client) {
await client.connect()
}
const searchParams = new URLSearchParams(location.search)
console.log('Handle inbound?', searchParams.has('inbound'))
if (searchParams.has('inbound')) {
Expand Down
2 changes: 2 additions & 0 deletions public/minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ window.ready = (callback) => {
}

async function connect() {
if (!_token) return

client = await SignalWire.SignalWire({
host: _host,
token: _token,
Expand Down

0 comments on commit d976200

Please sign in to comment.