Compare commits
No commits in common. "75a22b7b52b47d71facdea39c87e584f5892f649" and "b00f92a2fe67317295015e0bcd1294c9f753b802" have entirely different histories.
75a22b7b52
...
b00f92a2fe
5 changed files with 22 additions and 24 deletions
|
@ -15,33 +15,32 @@ const results = ref( {} );
|
||||||
/**
|
/**
|
||||||
* Load subnet data based on input
|
* Load subnet data based on input
|
||||||
*/
|
*/
|
||||||
const getSubnetData = async () => {
|
const getSubnetData = () => {
|
||||||
try {
|
// Enable loading icon
|
||||||
// Enable loading state
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
|
|
||||||
// Prepare request payload
|
// Create post data
|
||||||
const postData = new FormData();
|
const postData = new FormData();
|
||||||
postData.append( 'subnet', subnet.value );
|
postData.append( 'subnet', subnet.value );
|
||||||
|
|
||||||
// Send request and handle response
|
// Send request
|
||||||
const response = await axios.post( '/api/subnet', postData );
|
axios.post( '/api/subnet', postData ).then( (response) => {
|
||||||
const { data } = response;
|
const { data } = response;
|
||||||
|
|
||||||
// Update results and UI state
|
// Load new block
|
||||||
results.value = data.result;
|
isLoading.value = false;
|
||||||
hasResults.value = true;
|
hasResults.value = true;
|
||||||
} catch (error) {
|
results.value = data.result;
|
||||||
// Extract and show error message
|
} ).catch( (error) => {
|
||||||
const errorMessage = error.response?.data?.message || 'Something went wrong.';
|
isLoading.value = false;
|
||||||
|
|
||||||
|
// Show error message
|
||||||
|
const errorMessage = error.response.data.message || 'Something went wrong.';
|
||||||
$toast.error(errorMessage, {
|
$toast.error(errorMessage, {
|
||||||
position: 'top',
|
position: 'top',
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
});
|
});
|
||||||
} finally {
|
} );
|
||||||
// Reset loading state
|
|
||||||
isLoading.value = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@ import ToastPlugin from 'vue-toast-notification';
|
||||||
import 'vue-toast-notification/dist/theme-default.css';
|
import 'vue-toast-notification/dist/theme-default.css';
|
||||||
|
|
||||||
// Import components
|
// Import components
|
||||||
import Subnet from '@scripts/app/Subnet.vue';
|
import Subnet from '@app/Subnet.vue';
|
||||||
|
|
||||||
// Initialize vue app
|
// Initialize vue app
|
||||||
function initializeApp(element: string, component: any): void {
|
function initializeApp(element: string, component: any): void {
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace Core\Http;
|
namespace Core\Http;
|
||||||
|
|
||||||
|
use Core\View\JsonRender;
|
||||||
use Core\View\Render;
|
use Core\View\Render;
|
||||||
use Core\View\Render\HtmlRender;
|
use Core\View\Render\HtmlRender;
|
||||||
use Core\View\Render\JsonRender;
|
|
||||||
|
|
||||||
class Response
|
class Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Core\View\Render;
|
namespace Core\View;
|
||||||
|
|
||||||
use Core\View\Render;
|
|
||||||
|
|
||||||
class JsonRender extends Render
|
class JsonRender extends Render
|
||||||
{
|
{
|
|
@ -23,7 +23,8 @@ export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@styles': path.resolve('resources/styles'),
|
'@styles': path.resolve('resources/styles'),
|
||||||
'@scripts': path.resolve('resources/scripts')
|
'@scripts': path.resolve('resources/scripts'),
|
||||||
|
'@app': path.resolve('resources/scripts/app')
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue