fix
This commit is contained in:
parent
33fc9bf1b4
commit
871cb60022
File diff suppressed because one or more lines are too long
|
|
@ -45,7 +45,6 @@ export const initExtNotif = async (vi: VG, prasi_ext: PrasiExt) => {
|
|||
if (window.parent) {
|
||||
window.addEventListener("message", async ({ data: raw }) => {
|
||||
if (typeof raw === "object" && raw.mobile) {
|
||||
console.log(raw);
|
||||
const data = raw as unknown as
|
||||
| {
|
||||
type: "notification-token";
|
||||
|
|
@ -144,4 +143,21 @@ export const initExtNotif = async (vi: VG, prasi_ext: PrasiExt) => {
|
|||
|
||||
window.parent.postMessage({ mobile: true, type: "ready" }, "*");
|
||||
}
|
||||
|
||||
w.notif = {
|
||||
async send(data: NOTIF_ARG) {
|
||||
if (vi && vi.site.api) {
|
||||
return await vi.site.api._notif("send", {
|
||||
type: "send",
|
||||
id:
|
||||
typeof data.user_id === "string"
|
||||
? data.user_id
|
||||
: data.user_id.toString(),
|
||||
body: data.body,
|
||||
title: data.title,
|
||||
data: data.data,
|
||||
});
|
||||
}
|
||||
},
|
||||
} as any;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue