Macro recorder update, Macro service added (for the panels)

This commit is contained in:
Jesse Malotaux 2025-04-11 14:02:07 +02:00
parent d07b6eb820
commit 4ce03f7a4b
6 changed files with 48 additions and 24 deletions

View 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)
}