Try fix
This commit is contained in:
parent
cbdac511dd
commit
81f20afcb6
2 changed files with 7 additions and 11 deletions
|
@ -11,8 +11,8 @@ import ToHTML from './ToHTML';
|
||||||
|
|
||||||
type PuzzleData = {
|
type PuzzleData = {
|
||||||
answer: string;
|
answer: string;
|
||||||
filename: string;
|
// filename: string;
|
||||||
code_file: File[];
|
// code_file: File[];
|
||||||
};
|
};
|
||||||
|
|
||||||
type Granted = {
|
type Granted = {
|
||||||
|
@ -24,8 +24,6 @@ export default function Puzzle({ puzzle }: { puzzle: PuzzleType }) {
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
// const [granted, setGranted] = useState({});
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
|
@ -33,9 +31,9 @@ export default function Puzzle({ puzzle }: { puzzle: PuzzleType }) {
|
||||||
setError
|
setError
|
||||||
} = useForm<PuzzleData>({
|
} = useForm<PuzzleData>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
answer: '',
|
answer: ''
|
||||||
filename: '',
|
// filename: '',
|
||||||
code_file: []
|
// code_file: []
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -48,8 +46,8 @@ export default function Puzzle({ puzzle }: { puzzle: PuzzleType }) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
formData.append('answer', data.answer);
|
formData.append('answer', data.answer);
|
||||||
formData.append('filename', 'placeholder');
|
// formData.append('filename', 'placeholder');
|
||||||
formData.append('code_file', new Blob(), 'placeholder');
|
// formData.append('code_file', new Blob(), 'placeholder');
|
||||||
|
|
||||||
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/puzzleResponse/${puzzle.id}`, {
|
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/puzzleResponse/${puzzle.id}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
@ -86,8 +86,6 @@ export default function UserAuthForm() {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const token = res.headers.get('Authorization')?.split(' ')[1];
|
const token = res.headers.get('Authorization')?.split(' ')[1];
|
||||||
if (token) {
|
if (token) {
|
||||||
console.log(token);
|
|
||||||
|
|
||||||
cookies.set('token', token, {
|
cookies.set('token', token, {
|
||||||
sameSite: 'strict',
|
sameSite: 'strict',
|
||||||
secure: process.env.NODE_ENV === 'production'
|
secure: process.env.NODE_ENV === 'production'
|
||||||
|
|
Loading…
Add table
Reference in a new issue