Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
fix: BE unsupported lang
Browse files Browse the repository at this point in the history
  • Loading branch information
yashim-deriv committed Jun 23, 2024
1 parent 289e7fa commit f24f2cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 0 additions & 2 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
module.exports = {
extends: ['@commitlint/config-conventional'],

rules: {
'type-enum': [
2,
Expand Down
8 changes: 6 additions & 2 deletions themes/gatsby-theme-deriv/src/common/websocket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ export class ApiManager {
public init(lang?: string) {
if (!this.ready) {
if (!this.socket) {
// unsupported lang handler
const language = lang === 'ach' ? getCrowdin() : lang?.replace('-', '_')
const socket_lang = ['km'].includes(language) ? 'en' : language
const socket_url = getSocketURL()
const app_id = getAppId()
const websocket_connection_url = `${socket_url}?app_id=${app_id}&l=${language}&brand=${brand_name.toLowerCase()}`
const websocket_connection_url = `${socket_url}?app_id=${app_id}&l=${socket_lang}&brand=${brand_name.toLowerCase()}`

this.socket = new WebSocket(websocket_connection_url)
this.setReadyState(this.socket?.readyState)
Expand Down Expand Up @@ -99,9 +101,11 @@ export class ApiManager {
}

public reset(language: string) {
// unsupported lang handler
const socket_lang = ['km'].includes(language) ? 'en' : language
const socket_url = getSocketURL()
const app_id = getAppId()
const websocket_connection_url = `${socket_url}?app_id=${app_id}&l=${language}&brand=${brand_name.toLowerCase()}`
const websocket_connection_url = `${socket_url}?app_id=${app_id}&l=${socket_lang}&brand=${brand_name.toLowerCase()}`

this.derivApi.disconnect()
this.socket.close()
Expand Down

0 comments on commit f24f2cb

Please sign in to comment.