mirror of
https://github.com/Macrame-App/Macrame
synced 2025-12-29 15:29:26 +00:00
Macro recorder update, Macro service added (for the panels)
This commit is contained in:
parent
d07b6eb820
commit
4ce03f7a4b
6 changed files with 48 additions and 24 deletions
24
fe/src/services/MacroService.js
Normal file
24
fe/src/services/MacroService.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import axios from 'axios'
|
||||
import { appUrl, isLocal } from './ApiService'
|
||||
import { AuthCall } from './EncryptService'
|
||||
|
||||
export const GetMacroList = async () => {
|
||||
const request = await axios.post(appUrl() + '/macro/list')
|
||||
return sortMacroList(request.data)
|
||||
}
|
||||
|
||||
const sortMacroList = (list) => {
|
||||
return [...list].sort((a, b) => a.name.localeCompare(b.name))
|
||||
}
|
||||
|
||||
export const RunMacro = async (macro) => {
|
||||
const data = isLocal() ? { macro: macro } : AuthCall({ macro: macro })
|
||||
const request = await axios.post(appUrl() + '/macro/play', data)
|
||||
return request.data
|
||||
}
|
||||
|
||||
export const CheckMacroListChange = (oldList, newList) => {
|
||||
console.log(oldList, JSON.stringify(newList))
|
||||
|
||||
return oldList !== JSON.stringify(newList)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue