mirror of
https://github.com/owncast/owncast.git
synced 2024-10-25 22:15:59 +03:00
19 lines
492 B
JavaScript
19 lines
492 B
JavaScript
|
import {URL_CHAT_REGISTRATION} from "../utils/constants.js";
|
||
|
|
||
|
export async function registerChat(username) {
|
||
|
const options = {
|
||
|
method: 'POST',
|
||
|
headers: {
|
||
|
'Content-Type': 'application/json'
|
||
|
},
|
||
|
body: JSON.stringify({displayName: username})
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
const response = await fetch(URL_CHAT_REGISTRATION, options);
|
||
|
const result = await response.json();
|
||
|
return result;
|
||
|
} catch(e) {
|
||
|
console.error(e);
|
||
|
}
|
||
|
}
|