mirror of
https://github.com/NohamR/lanyard-profile-readme.git
synced 2026-05-26 04:17:19 +00:00
🔥 Remove useless imports
This commit is contained in:
@@ -1,34 +1,39 @@
|
|||||||
import type { NextApiRequest, NextApiResponse } from 'next'
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
import axios from 'axios';
|
import axios from "axios";
|
||||||
import * as LanyardTypes from '../../src/LanyardTypes';
|
import renderCard from "../../src/renderCard";
|
||||||
import renderCard from '../../src/renderCard';
|
|
||||||
|
|
||||||
type Data = {
|
type Data = {
|
||||||
id?: string | string[]
|
id?: string | string[];
|
||||||
error?: any;
|
error?: any;
|
||||||
}
|
};
|
||||||
|
|
||||||
type Parameters = {
|
type Parameters = {
|
||||||
animated?: string;
|
animated?: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default async function handler(
|
export default async function handler(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse<Data>
|
res: NextApiResponse<Data>,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
let params: Parameters = req.query,
|
let params: Parameters = req.query,
|
||||||
userid = req.query.id[0],
|
userid = req.query.id[0],
|
||||||
lanyardData: any;
|
lanyardData: any;
|
||||||
|
|
||||||
res.setHeader("Content-Type", "image/svg+xml; charset=utf-8");
|
res.setHeader("Content-Type", "image/svg+xml; charset=utf-8");
|
||||||
res.setHeader("content-security-policy", "default-src 'none'; img-src * data:; style-src 'unsafe-inline'");
|
res.setHeader(
|
||||||
|
"content-security-policy",
|
||||||
|
"default-src 'none'; img-src * data:; style-src 'unsafe-inline'",
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lanyardData = await axios.get(`https://api.lanyard.rest/v1/users/${userid}`);
|
lanyardData = await axios.get(
|
||||||
|
`https://api.lanyard.rest/v1/users/${userid}`,
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e);
|
||||||
res.send({ error: `Something went wrong! If everything looks correct and this still occurs, please contact @cnraddd on Twitter.` })
|
res.send({
|
||||||
|
error: `Something went wrong! If everything looks correct and this still occurs, please contact @cnraddd on Twitter.`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let svg = await renderCard(lanyardData.data, params);
|
let svg = await renderCard(lanyardData.data, params);
|
||||||
|
|||||||
Reference in New Issue
Block a user