| import apiClient from './apiClient'; |
|
|
| class AccountService { |
| |
| |
| |
| |
| async getAll() { |
| try { |
| const response = await apiClient.get('/accounts'); |
| |
| |
| return response; |
| } catch (error) { |
| throw error; |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| async create(accountData) { |
| try { |
| const response = await apiClient.post('/accounts', { |
| account_name: accountData.account_name, |
| social_network: accountData.social_network |
| }); |
| |
| if (import.meta.env.VITE_NODE_ENV === 'development') { |
| console.log('📱 [Account] Account created:', response.data); |
| } |
| |
| return response; |
| } catch (error) { |
| throw error; |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| async delete(accountId) { |
| try { |
| const response = await apiClient.delete(`/accounts/${accountId}`); |
| |
| |
| return response; |
| } catch (error) { |
| throw error; |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| async handleCallback(callbackData) { |
| try { |
| const response = await apiClient.post('/accounts/callback', { |
| code: callbackData.code, |
| state: callbackData.state, |
| social_network: callbackData.social_network |
| }); |
| |
| |
| return response; |
| } catch (error) { |
| throw error; |
| } |
| } |
| } |
|
|
| export default new AccountService(); |