Skip to content

Commit

Permalink
fix: dynamic server (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickimoore authored Jun 25, 2024
1 parent ee1c79c commit 496da52
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { NextResponse } from 'next/server'
import getReqAuthToken from '../../../utilities/getReqAuthToken';
import { dismissLogAlert } from '../logs';
import getReqAuthToken from '../../../../utilities/getReqAuthToken';
import { dismissLogAlert } from '../../logs';

export async function GET(req: Request) {
export async function PUT(req: Request, context: any) {
try {
const url = new URL(req.url);
const index = url.searchParams.get('index');
const { index } = context.params;
const token = getReqAuthToken(req);

if (!index) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { NextResponse } from 'next/server'
import getReqAuthToken from '../../../utilities/getReqAuthToken';
import { fetchValGraffiti } from '../validator';
import getReqAuthToken from '../../../../utilities/getReqAuthToken';
import { fetchValGraffiti } from '../../validator';

export async function GET(req: Request) {
export async function GET(req: Request, context: any) {
try {
const url = new URL(req.url)
const index = url.searchParams.get('index')
const { index } = context.params;
const token = getReqAuthToken(req)

if (!index) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { NextResponse } from 'next/server'
import getReqAuthToken from '../../../utilities/getReqAuthToken';
import { fetchValMetrics } from '../validator';
import getReqAuthToken from '../../../../utilities/getReqAuthToken';
import { fetchValMetrics } from '../../validator';

export async function GET(req: Request) {
export async function GET(req: Request, context: any) {
try {
const url = new URL(req.url)
const index = url.searchParams.get('index')
const { index } = context.params;
const token = getReqAuthToken(req)

if (!token) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/AlertInfo/PriorityLogAlerts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const PriorityLogAlerts:FC<LogAlertsProps> = ({alerts}) => {
const dismissAlert = async (id: number) => {
try {
const token = Cookies.get('session-token')
const {status} = await axios.get(`/api/dismiss-log?index=${id}`, {
const {status} = await axios.put(`/api/dismiss-log/${id}`, undefined,{
headers: {
Authorization: `Bearer ${token}`
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ValidatorGraffiti/ValidatorGraffiti.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ValidatorGraffiti:FC<ValidatorGraffitiProps> = ({validator}) => {

const fetchGraffiti = async () => {
try {
const { data } = await axios.get(`/api/validator-graffiti?index=${index}`, config)
const { data } = await axios.get(`/api/validator-graffiti/${index}`, config)

if (data) {
setGraffiti(data.data)
Expand Down
2 changes: 1 addition & 1 deletion src/components/ValidatorModal/ValidatorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ValidatorModal: FC<ValidatorModalProps> = ({
const { index, status } = validator

const { data: validatorMetric } = useSWRPolling<ValidatorMetricResult>(
status !== 'withdrawal_done' ? `/api/validator-metrics?index=${index}` : null,
status !== 'withdrawal_done' ? `/api/validator-metrics/${index}` : null,
{ refreshInterval: 5 * 1000 },
)

Expand Down

0 comments on commit 496da52

Please sign in to comment.