支持免登录游客聊天并隔离历史与附件
This commit is contained in:
@@ -15,6 +15,7 @@ var SupportUI = {
|
||||
}catch(error){}
|
||||
},
|
||||
addRating(container, sid, labels){
|
||||
const request = labels.fetch || fetch;
|
||||
const box = document.createElement('section');
|
||||
box.className = 'service-rating';
|
||||
const question = document.createElement('p');
|
||||
@@ -40,7 +41,7 @@ var SupportUI = {
|
||||
sending = true;
|
||||
Array.from(choices.children).forEach(function(item){ item.disabled = true; });
|
||||
try{
|
||||
const response = await fetch('/api/rate', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({sid:sid, stars:stars, comment:''})});
|
||||
const response = await request('/api/rate', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({sid:sid, stars:stars, comment:''})});
|
||||
const data = await response.json();
|
||||
if(!response.ok || !data.ok) throw new Error('Rating failed');
|
||||
box.textContent = labels.thanks+' '+ '★'.repeat(stars);
|
||||
|
||||
Reference in New Issue
Block a user