-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2602ae8
commit 6afe910
Showing
8 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
REACT_APP_API_URL=https://i-mader.tech | ||
NEXT_PUBLIC_MEASUREMENT_ID=G-3FNP2LS55J |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import Script from 'next/script'; | ||
|
||
const GoogleAnalytics = () => { | ||
return ( | ||
<> | ||
<Script | ||
strategy='lazyOnload' | ||
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_MEASUREMENT_ID}`} | ||
/> | ||
|
||
<Script id='' strategy='lazyOnload'> | ||
{` | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
gtag('config', '${process.env.NEXT_PUBLIC_MEASUREMENT_ID}', { | ||
page_path: window.location.pathname, | ||
}); | ||
`} | ||
</Script> | ||
</> | ||
); | ||
}; | ||
|
||
export default GoogleAnalytics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import axios from 'axios'; | ||
import useSWR from 'swr'; | ||
// import { Task } from '../types/task'; | ||
|
||
export const useTasks = (callback?: Function) => { | ||
const api = axios.create({ | ||
baseURL: process.env.REACT_APP_API_URL, | ||
}); | ||
|
||
const fetcher = (url: string) => api.get(url).then((res) => res.data); | ||
|
||
// const { data, error, mutate } = useSWR<Task[], Error>('/tasks', fetcher, { | ||
// onSuccess: (data, key) => { | ||
// if (callback) callback(); | ||
// }, | ||
// }); | ||
|
||
// const createTask = async (task: Task) => { | ||
// if (!data) { | ||
// return false; | ||
// } | ||
// const result = await api.post<Task>('//api/v1/contact-us/add', task); | ||
// mutate([...data, result.data]); | ||
// }; | ||
|
||
// const updateTask = async (task: Task) => { | ||
// if (!data) { | ||
// return false; | ||
// } | ||
// const { data: updatedTask } = await api.patch<Task>( | ||
// `/tasks/${task.id}`, | ||
// task | ||
// ); | ||
// mutate( | ||
// data.map( | ||
// (task) => (task.id === updatedTask.id ? updatedTask : task), | ||
// false | ||
// ) | ||
// ); | ||
// }; | ||
|
||
// const removeTask = async (task: Task) => { | ||
// if (!data) { | ||
// return false; | ||
// } | ||
// await api.delete<Task>(`/tasks/${task.id}`); | ||
// mutate(data.filter((item) => item.id === task.id, false)); | ||
// }; | ||
|
||
// return { data, error, createTask, updateTask, removeTask }; | ||
// return { data, error, createTask }; | ||
}; |
Empty file.