Skip to content
Snippets Groups Projects
Commit 62409b83 authored by Bayu Samudra's avatar Bayu Samudra
Browse files

Merge branch 'staging' of...

Merge branch 'staging' of gitlab.informatika.org:IF3250_2023_2_24_OPEN-COURSEWARE/ocw-frontend into staging
parents e05893f9 d5a5c4b0
Branches
Tags v1.1.3
1 merge request!22Staging v1.3.0
Pipeline #52013 failed with stage
in 2 minutes and 54 seconds
NEXT_PUBLIC_API_URL=http://localhost:8080
\ No newline at end of file
......@@ -17,9 +17,11 @@ import {
useDisclosure,
} from '@chakra-ui/react'
import { MdMenu, MdOutlineArrowDropDown } from 'react-icons/md'
import { useRouter } from 'next/router'
export default function Navbar() {
const { isOpen, onOpen, onClose } = useDisclosure()
const router = useRouter()
return (
<>
......@@ -54,7 +56,7 @@ export default function Navbar() {
</HStack>
</MenuButton>
<MenuList color="black">
<MenuItem>Logout</MenuItem>
<MenuItem onClick={() => router.push('/login')}>Logout</MenuItem>
</MenuList>
</Menu>
</HStack>
......
......@@ -13,12 +13,14 @@ import {
import styles from '@/styles/Login.module.css';
import React, {useState} from 'react';
import axios from 'axios';
import { useRouter } from 'next/router';
const Login = () => {
const [user, setUser] = useState({
email : '',
password : '',
});
const router = useRouter();
const handleChange = (type: string, e: any) => {
let updatedValue = {};
if(type == 'email'){
......@@ -30,9 +32,10 @@ const Login = () => {
};
const handleSubmit = (e: any) => {
e.preventDefault();
axios.post('http://localhost:8080/auth/login', user)
axios.post(`${process.env.NEXT_PUBLIC_API_URL}/auth/login`, user)
.then((response) => {
console.log(response.data);
router.push('/admin');
}, (error) => {
if(error.response.status === 400 || error.response.status === 403){
alert("Username atau password anda salah!");
......
......@@ -27,9 +27,9 @@ const Register = () => {
<FormLabel>Alamat Email</FormLabel>
<Input placeholder='Alamat Email'></Input>
<FormLabel>Kata Sandi</FormLabel>
<Input placeholder='Kata Sandi'></Input>
<Input placeholder='Kata Sandi' type="password"></Input>
<FormLabel>Konfirmasi Kata Sandi</FormLabel>
<Input placeholder='Konfirmasi Kata Sandi'></Input>
<Input placeholder='Konfirmasi Kata Sandi' type="password"></Input>
</FormControl>
<Checkbox>Saya ingin menjadi kontributor</Checkbox>
<Text>Dengan menekan tombol daftar di bawah ini, saya menyetujui Persyaratan Layanan dan Kebijakan Privasi kami.</Text>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment