Skip to content

Commit

Permalink
fix: update temp js
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuzhy-Deriv committed Nov 4, 2024
1 parent ffdccfc commit 2541de9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions public/scripts/freshchat-temp.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
class FreshChat {
constructor({ token = null, hideButton = false, serverUrl, appId } = {}) {
hostname = localStorage.getItem("config.server_url") || "green.derivws.com";
appId = localStorage.getItem("config.app_id") || 16929;

constructor({ token = null, hideButton = false } = {}) {
this.authToken = token;
this.hideButton = hideButton;
this.hostname = serverUrl;
this.appId = appId;
this.init();
}

Expand All @@ -16,8 +17,8 @@ class FreshChat {
if (this.authToken) {
jwt = await this.fetchJWTToken({
token: this.authToken,
appId: this.appId || 1,
server: this.hostname || "green.derivws.com",
appId: this.appId,
server: this.hostname,
});
}

Expand Down Expand Up @@ -69,10 +70,8 @@ class FreshChat {
}

const data = await response.json();
console.log("Service Token Response:", data);
return data?.service_token?.freshworks_user_jwt?.token;
} catch (error) {
console.error("Fetch error:", error);
return null;
}
};
Expand Down

0 comments on commit 2541de9

Please sign in to comment.