Skip to content

Instantly share code, notes, and snippets.

type TemplateType = {
template: string;
id: string;
};
function withTemplate(templateObj: TemplateType) {
return function (constructor: any) {
let el = document.getElementById(templateObj.id);
let p = new constructor();
if (el) {
// send POST request to /wp-json/jwt-auth/v1/token voi data
{
"username" : "admin",
"password": "123456"
}
// ket qua nhan ve se gom truong token