add support socket noti
This commit is contained in:
parent
e81b47bbe4
commit
57b6bf2627
1 changed files with 6 additions and 2 deletions
|
|
@ -3,8 +3,8 @@ import { Notify } from "quasar";
|
|||
import { io, Socket } from "socket.io-client";
|
||||
|
||||
import config from "@/app.config";
|
||||
import { getToken } from "@/plugins/auth";
|
||||
import { useOrganizational } from "@/modules/02_organization/store/organizational";
|
||||
import { getToken } from "@/plugins/auth";
|
||||
interface sockeBackup {
|
||||
message: string;
|
||||
success?: boolean;
|
||||
|
|
@ -12,7 +12,6 @@ interface sockeBackup {
|
|||
|
||||
export const useSocketStore = defineStore("socket", () => {
|
||||
let socket: Socket;
|
||||
const storeOrg = useOrganizational();
|
||||
|
||||
async function init() {
|
||||
socket = io(new URL(config.API.socket).origin, {
|
||||
|
|
@ -24,6 +23,11 @@ export const useSocketStore = defineStore("socket", () => {
|
|||
notifyStatus(body.message, body.success);
|
||||
});
|
||||
|
||||
socket.on("send-notification", (payload) => {
|
||||
let body: sockeBackup = JSON.parse(payload);
|
||||
notifyStatus(body.message, body.success);
|
||||
});
|
||||
|
||||
socket.on("send-create-draft-org", (payload) => {
|
||||
let body: sockeBackup = JSON.parse(payload);
|
||||
if (body.message == "ระบบกำลังทำการสร้างแบบร่างโครงสร้างหน่วยงาน") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue