@@ -14,28 +14,30 @@ import { Allocation } from '@/api/server/getServer';
1414import Spinner from '@/components/elements/Spinner' ;
1515import setPrimaryServerAllocation from '@/api/server/network/setPrimaryServerAllocation' ;
1616import useFlash from '@/plugins/useFlash' ;
17- import { httpErrorToHuman } from '@/api/http' ;
1817
1918const Code = styled . code `${ tw `font-mono py-1 px-2 bg-neutral-900 rounded text-sm block` } ` ;
2019const Label = styled . label `${ tw `uppercase text-xs mt-1 text-neutral-400 block px-1 select-none transition-colors duration-150` } ` ;
2120
2221const NetworkContainer = ( ) => {
2322 const server = useServer ( ) ;
24- const { clearFlashes, clearAndAddError } = useFlash ( ) ;
23+ const { clearFlashes, clearAndAddHttpError } = useFlash ( ) ;
2524 const { data, error, mutate } = useSWR < Allocation [ ] > ( server . uuid , key => getServerAllocations ( key ) , { initialData : server . allocations } ) ;
2625
2726 const setPrimaryAllocation = ( ip : string , port : number ) => {
2827 clearFlashes ( 'server:network' ) ;
2928
30- mutate ( data ?. map ( a => ( a . ip === ip && a . port === port ) ? { ...a , isDefault : true } : { ...a , isDefault : false } ) , false ) ;
29+ mutate ( data ?. map ( a => ( a . ip === ip && a . port === port ) ? { ...a , isDefault : true } : {
30+ ...a ,
31+ isDefault : false ,
32+ } ) , false ) ;
3133
3234 setPrimaryServerAllocation ( server . uuid , ip , port )
33- . catch ( error => clearAndAddError ( { key : 'server:network' , message : httpErrorToHuman ( error ) } ) ) ;
35+ . catch ( error => clearAndAddHttpError ( { key : 'server:network' , error } ) ) ;
3436 } ;
3537
3638 useEffect ( ( ) => {
3739 if ( error ) {
38- clearAndAddError ( { key : 'server:network' , message : error } ) ;
40+ clearAndAddHttpError ( { key : 'server:network' , error } ) ;
3941 }
4042 } , [ error ] ) ;
4143
0 commit comments