-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed chest page using sockets instead refetch
- Loading branch information
1 parent
2402a58
commit 59bdc59
Showing
7 changed files
with
65 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
import { socketVariables } from '@/libs/socketVariables' | ||
import express from 'express' | ||
import { sendChests } from '@/socketEmit'; | ||
|
||
const router = express.Router() | ||
|
||
router.get('/chests', (req, res) => { | ||
res.json({ chests: socketVariables.chests }) | ||
}) | ||
|
||
router.delete('/chest/:uuid', (req, res) => { | ||
const uuid = req.params.uuid | ||
delete socketVariables.chests[uuid] | ||
sendChests() | ||
|
||
res.json({ success: true}) | ||
}) | ||
|
||
export default router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export * from './sendBotConnect' | ||
export * from './sendBotsOnline' | ||
export * from './sendChests' | ||
export * from './sendCoreIsConnected' | ||
export * from './sendLogs' | ||
export * from './sendMastersOnline' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { io } from "@/server"; | ||
import { socketVariables } from '@/libs/socketVariables' | ||
|
||
export const sendChests = () => { | ||
io | ||
.to("web") | ||
.to("bot") | ||
.emit("action", { | ||
type: "getChests", | ||
value: socketVariables.chests, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters