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

Fix axios-retry@3.9.1 TS error #44

Merged
merged 5 commits into from
Nov 20, 2023
Merged
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
4 changes: 2 additions & 2 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"@commander-js/extra-typings": "^10.0.3",
"@sde/cdk": "*",
"@sde/web": "*",
"axios": "^1.3.4",
"axios-retry": "^3.4.0",
"axios": "1.6.0",
"axios-retry": "3.9.0",
"commander": "^10.0.0",
"csv-parse": "^5.3.6",
"csv-stringify": "^6.4.4",
Expand Down
3 changes: 3 additions & 0 deletions apps/web/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
public/dsfr
build-storybook.log
dist/
/public/robots.txt
/public/sitemap.xml
/public/sitemap*.xml
5 changes: 1 addition & 4 deletions apps/web/next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/** @type {import('next-sitemap').IConfig} */

import { getServerUrl } from '@sde/web/utils/baseUrl';

module.exports = {
// siteUrl: 'https://solutionsdelus.gouv.fr',
siteUrl: getServerUrl(),
siteUrl: 'https://solutionsdelus.gouv.fr',
generateRobotsTxt: true,
};
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@trpc/client": "^10.43.0",
"@trpc/react-query": "^10.43.0",
"@trpc/server": "^10.43.0",
"axios": "^1.3.4",
"axios": "1.6.0",
"chart.js": "^4.4.0",
"client-only": "^0.0.1",
"copy": "^0.3.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/(public)/PublicFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const PublicFooter = () => (
<li className="fr-footer__bottom-item">
<a
className="fr-footer__bottom-link"
href="https://github.com/inclusion-numerique/projets-territoires"
href="https://github.com/inclusion-numerique/solutions-elus"
target="_blank"
rel="noreferrer"
title="Code source"
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/(public)/projets/[slug]/Localization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Localization = ({
className,
}: {
project: ProjectItem
collectiviteUrl?: string;
collectiviteUrl: string | null
className?: string
}) => (
<div className={className ?? ''}>
Expand All @@ -21,7 +21,7 @@ const Localization = ({
) : null}
<div className={`fr-p-6v ${styles.bloc}`}>
<h2 className="fr-mb-0 fr-text-title--blue-france">Le territoire</h2>
{project.localization.echelon === 'commune' ?
{(project.localization.echelon === 'commune' && collectiviteUrl) ?
(
<p className="fr-mt-6v fr-mb-0 fr-text--bold">
<a href={collectiviteUrl} target="_blank">
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/(public)/projets/[slug]/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Quotes from './Quotes'
import styles from './Project.module.css'
import SocialNetworks from './SocialNetworks'

const Project = ({ project, collectiviteUrl }: { project: ProjectItem, collectiviteUrl?: string }) => {
const Project = ({ project, collectiviteUrl }: { project: ProjectItem, collectiviteUrl: string | null }) => {
const coverPicture = (
<picture>
<img
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/(public)/projets/[slug]/Quote.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getProjectFilePath } from '@sde/web/project/project'
import Image from 'next/image'
import Image from 'next/legacy/image'
import React from 'react'
import { textToParagraphs } from '@sde/web/utils/textParser'
import styles from './Quote.module.css'
Expand Down
21 changes: 11 additions & 10 deletions apps/web/src/app/(public)/projets/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,26 @@ type Localization = {

const getCollectiviteUrl = async (localization: Localization) => {
const res = await fetch(`https://api.collectivite.fr/api/commune/search/${encodeURIComponent(localization.label)}`)
const data = await res.json()
const data: Collectivite[] = await res.json()

const sameName = data.filter((item: Collectivite) => item.city.toLowerCase() === localization.label.toLowerCase())
const target = sameName.find((item: Collectivite) =>
item.zip_code ? item.zip_code.startsWith(localization.department || '') : true
)
const slug = target.slug_alias || target.slug || ""
const sameName = data.filter(item => item.city.toLowerCase() === localization.label.toLowerCase())
const target = sameName.find(item => {
if (item.region === "Corse") return localization.regionName ? item.region === localization.regionName : true
return localization.department ? item.zip_code.startsWith(localization.department) : true
})
const slug = target?.slug_alias || target?.slug

return `https://collectivite.fr/${slug}`;
if (slug) return `https://collectivite.fr/${slug}`;
return null
};

const ProjectPage = async ({ params }: { params: { slug: string } }) => {
const project = await getProject(params.slug)
if (!project) {
notFound()
return {}
}
const collectiviteUrl = project.localization.echelon === 'commune' ?
await getCollectiviteUrl(project.localization) : ""

const collectiviteUrl = await getCollectiviteUrl(project.localization)

return (
<div className="fr-container">
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"node": "^18.16"
},
"dependencies": {
"axios": "^1.3.4",
"axios": "1.6.0",
"dotenv": "^16.0.3",
"dotenv-cli": "^7.1.0",
"nanoid": "^3.3.6"
Expand Down
28 changes: 9 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.