2FAuth/resources/js_vue3/services/twofaccountService.js

70 lines
2.1 KiB
JavaScript
Raw Normal View History

2023-10-19 11:45:21 +02:00
import { httpClientFactory } from '@/services/httpClientFactory'
const apiClient = httpClientFactory('api')
export default {
getAll(withOtp = false) {
return apiClient.get('/twofaccounts' + (withOtp ? '?withOtp=1' : ''))
2023-10-19 11:45:21 +02:00
},
2023-10-24 13:27:50 +02:00
getByIds(ids, withOtp = false) {
return apiClient.get('/twofaccounts?ids=' + ids + (withOtp ? '&withOtp=1' : ''))
},
2023-10-19 11:45:21 +02:00
get(id, config = {}) {
return apiClient.get('/twofaccounts/' + id, { ...config })
},
preview(uri, config = {}) {
return apiClient.post('/twofaccounts/preview', { uri: uri }, { ...config })
},
getLogo(service, config = {}) {
return apiClient.post('/icons/default', { service: service }, { ...config })
},
deleteIcon(icon, config = {}) {
return apiClient.delete('/icons/' + icon, { ...config })
},
getOtpById(id, config = {}) {
return apiClient.get('/twofaccounts/' + id + '/otp', { ...config })
},
getOtpByUri(uri, config = {}) {
return apiClient.post('/twofaccounts/otp', { uri: uri }, { ...config })
},
getOtpByParams(params, config = {}) {
return apiClient.post('/twofaccounts/otp', params, { ...config })
},
withdraw(ids, config = {}) {
return apiClient.patch('/twofaccounts/withdraw?ids=' + ids.join(), { ...config })
},
saveOrder(orderedIds, config = {}) {
return apiClient.post('/twofaccounts/reorder', { orderedIds: orderedIds }, { ...config })
},
batchDelete(ids, config = {}) {
return apiClient.delete('/twofaccounts?ids=' + ids, { ...config })
},
export(ids, config = {}) {
2023-11-10 14:23:52 +01:00
return apiClient.get('/twofaccounts/export?ids=' + ids, { ...config })
},
2023-10-27 16:09:59 +02:00
getQrcode(id, config = {}) {
return apiClient.get('/twofaccounts/' + id + '/qrcode', { ...config })
2023-10-31 11:41:24 +01:00
},
migrate(payload, config = {}) {
return apiClient.post('/twofaccounts/migration', { payload: payload, withSecret: true }, { ...config })
},
count(config = {}) {
return apiClient.get('/twofaccounts/count', { ...config })
},
2023-10-19 11:45:21 +02:00
}