fix(browser-extension): send user url
This commit is contained in:
parent
6da1d0762b
commit
b4a315e309
@ -65,13 +65,13 @@ const refreshData = (callback) => {
|
|||||||
const report = async (message, tab, callback) => {
|
const report = async (message, tab, callback) => {
|
||||||
try {
|
try {
|
||||||
const reason = message.reason;
|
const reason = message.reason;
|
||||||
|
const url = message.url;
|
||||||
const userAgent = message.userAgent;
|
const userAgent = message.userAgent;
|
||||||
const version = browser.runtime.getManifest().version;
|
const version = browser.runtime.getManifest().version;
|
||||||
const body = JSON.stringify({ reason, url: tab.url, userAgent, version });
|
const body = JSON.stringify({ reason, url, userAgent, version });
|
||||||
const headers = { 'Cache-Control': 'no-cache', 'Content-type': 'application/json' };
|
const headers = { 'Cache-Control': 'no-cache', 'Content-type': 'application/json' };
|
||||||
const url = `${apiUrl}/report/`;
|
|
||||||
|
|
||||||
const response = await fetch(url, { body, headers, method: 'POST' });
|
const response = await fetch(`${apiUrl}/report/`, { body, headers, method: 'POST' });
|
||||||
callback?.((await response.json()).data);
|
callback?.((await response.json()).data);
|
||||||
} catch {
|
} catch {
|
||||||
console.error("Can't send report");
|
console.error("Can't send report");
|
||||||
|
@ -247,7 +247,6 @@ async function submitButtonClickHandler(event) {
|
|||||||
const issueButton = dialog?.getElementsByClassName('report-dialog-issue-button')[0];
|
const issueButton = dialog?.getElementsByClassName('report-dialog-issue-button')[0];
|
||||||
const submitView = dialog?.getElementsByClassName('report-dialog-submit-view')[0];
|
const submitView = dialog?.getElementsByClassName('report-dialog-submit-view')[0];
|
||||||
const userAgent = window.navigator.userAgent;
|
const userAgent = window.navigator.userAgent;
|
||||||
|
|
||||||
const issueUrl = await dispatch({ userAgent, reason: reasonText, url: urlText, type: 'REPORT' });
|
const issueUrl = await dispatch({ userAgent, reason: reasonText, url: urlText, type: 'REPORT' });
|
||||||
|
|
||||||
formView?.setAttribute('hidden', 'true');
|
formView?.setAttribute('hidden', 'true');
|
||||||
|
Loading…
Reference in New Issue
Block a user