random messages
This commit is contained in:
28
src/components/RandomMsg.jsx
Normal file
28
src/components/RandomMsg.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { API_URL } from "../config";
|
||||
import { default as $ } from "jquery";
|
||||
|
||||
var randomMsg;
|
||||
|
||||
const getRandomMsg = () => {
|
||||
$.ajax({
|
||||
url: API_URL+'/randmsg',
|
||||
method: "POST",
|
||||
contentType: "application/json; charset=utf-8"
|
||||
}).done(function (data) {
|
||||
if (! data.msg) {
|
||||
return;
|
||||
} else {
|
||||
randomMsg = data.msg.replace("<br>", "\n");
|
||||
$('.random-msg').html(`<small><i>${randomMsg}</i></small>`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default function RandomMsg() {
|
||||
getRandomMsg();
|
||||
return (
|
||||
<div className="random-msg">
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user