Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

features --> publish #90

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions .github/workflows/deployer.yml

This file was deleted.

71 changes: 0 additions & 71 deletions azure-pipelines.yml

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "quiz-app",
"homepage": "https://kushwahramkumar2003.github.io/Online-Quiz",
"version": "0.1.0",
"private": true,
"proxy": "https://quiz-app-test-01.azurewebsites.net/",
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function App() {
return (
<div>
<Routes>
<Route path="/Online-Quiz" element={<Home />}></Route>
<Route path="/" element={<Home />}></Route>
<Route exact path="/login" element={<Login />}></Route>
<Route exact path="/SignUp" element={<Signup />}></Route>
<Route exact path="/User" element={<UserPage />}></Route>
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
import { HashRouter } from "react-router-dom";
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
import { Provider } from "react-redux";
import { Toaster } from "react-hot-toast";
Expand All @@ -12,12 +12,12 @@ const queryClient = new QueryClient();

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<BrowserRouter>
<HashRouter>
<Provider store={store}>
<QueryClientProvider client={queryClient}>
<App className="transition-all scroll-smooth " />
<Toaster />
</QueryClientProvider>
</Provider>
</BrowserRouter>
</HashRouter>
);
8 changes: 4 additions & 4 deletions src/pages/login/login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ export default function Login() {
color: "black",
};

const { mutate} = useMutation({
const { mutate } = useMutation({
mutationFn: ({ email, password }) => {
return login({ email, password });
},
onSuccess: (data) => {
onSuccess: async (data) => {
const { user } = data;

dispatch(userActions.setUserInfo(data.user));
localStorage.setItem("account", JSON.stringify(data));
await dispatch(userActions.setUserInfo(data.user));
await localStorage.setItem("account", JSON.stringify(data));
toast.success("Login successfully");

// console.log("User.role : ", user.role);
Expand Down
8 changes: 8 additions & 0 deletions src/services/baseUrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import axios from "axios";

const api = axios.create({
// baseURL: "https://quiz-app-test-01.azurewebsites.net",
// baseURL: "http://localhost:3001",
});

export default api;
8 changes: 6 additions & 2 deletions src/services/feedback.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import axios from "axios";
// import api from "./baseUrl";

import axios from "axios";

const api = axios;

export const submitFeedback = async (formData) => {
try {
// Assuming you have a backend endpoint to handle feedback submission
const { data } = await axios.post("/api/v1/feedback/submit", formData);
const { data } = await api.post("/api/v1/feedback/submit", formData);
// Optionally, you can add logic to handle success (e.g., redirect)
return data;
} catch (error) {
Expand Down
27 changes: 16 additions & 11 deletions src/services/quiz.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// import api from "./baseUrl";
import axios from "axios";

const api = axios;

export const createNewQuiz = async ({
title,
description,
Expand All @@ -14,7 +17,7 @@ export const createNewQuiz = async ({
console.log("Level", level);

try {
const { data } = await axios.post("/api/v1/quiz/create", {
const { data } = await api.post("/api/v1/quiz/create", {
title,
description,
category,
Expand All @@ -41,7 +44,7 @@ export const addQuestionInQuiz = async ({
console.log("Question", question);
console.log("Options", options);
console.log("Correct Answer", correctAnswer);
const { data } = await axios.post(
const { data } = await api.post(
`/api/v1/quiz//create/addQuestion/${quizId}`,
{
question,
Expand All @@ -60,7 +63,9 @@ export const addQuestionInQuiz = async ({

export const getAllQuizs = async () => {
try {
const { data } = await axios.get(`/api/v1/quiz`);
const { data } = await api.get(`/api/v1/quiz`, {
withCredentials: true,
});
console.log("All Quezzes", data);
return data;
} catch (error) {
Expand All @@ -74,7 +79,7 @@ export const getAllQuizs = async () => {
export const getQuizById = async ({ quizId }) => {
try {
console.log("Quiz Id", quizId);
const { data } = await axios.get(`/api/v1/quiz/${quizId}`);
const { data } = await api.get(`/api/v1/quiz/${quizId}`);
return data;
} catch (error) {
if (error.response) {
Expand All @@ -86,7 +91,7 @@ export const getQuizById = async ({ quizId }) => {

export const updateQuizById = async ({ title, quizId }) => {
try {
const { data } = await axios.put(`/api/v1/quiz/${quizId}/update`, {
const { data } = await api.put(`/api/v1/quiz/${quizId}/update`, {
title,
});
return data;
Expand All @@ -106,7 +111,7 @@ export const updateQuestionByQuizId = async ({
correctAnswer,
}) => {
try {
const { data } = await axios.put(
const { data } = await api.put(
`/api/v1/quiz/${quizId}/question/${questionId}/update`,
{
question,
Expand All @@ -125,7 +130,7 @@ export const updateQuestionByQuizId = async ({

export const deleteQuiz = async ({ quizId }) => {
try {
const { data } = await axios.delete(`/api/v1/quiz/${quizId}/delete`);
const { data } = await api.delete(`/api/v1/quiz/${quizId}/delete`);
return data;
} catch (error) {
if (error.response) {
Expand All @@ -137,7 +142,7 @@ export const deleteQuiz = async ({ quizId }) => {

export const deleteQuestionByQuizId = async ({ quizId, questionId }) => {
try {
const { data } = await axios.delete(
const { data } = await api.delete(
`/api/v1/quiz/${quizId}/question/${questionId}/delete`
);
return data;
Expand All @@ -149,10 +154,10 @@ export const deleteQuestionByQuizId = async ({ quizId, questionId }) => {
}
};

export const publishQuiz = async ({ quizId,publish }) => {
export const publishQuiz = async ({ quizId, publish }) => {
try {
const { data } = await axios.put(`/api/v1/quiz/${quizId}/publish`, {
publish
const { data } = await api.put(`/api/v1/quiz/${quizId}/publish`, {
publish,
});
return data;
} catch (error) {
Expand Down
8 changes: 6 additions & 2 deletions src/services/user.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// import api from "./baseUrl";

import axios from "axios";

const api = axios;

export const signup = async ({ name, email, password }) => {
try {
const { data } = await axios.post("api/v1/auth/register", {
const { data } = await api.post("api/v1/auth/register", {
name,
email,
password,
Expand All @@ -19,7 +23,7 @@ export const signup = async ({ name, email, password }) => {

export const login = async ({ email, password }) => {
try {
const { data } = await axios.post("/api/v1/auth/login", {
const { data } = await api.post("/api/v1/auth/login", {
email,
password,
});
Expand Down
Loading